Create a C application that prompts the user for storm winds
Create a C# application that prompts the user for storm windspeed in mph, then determines the correct typhoon category. The program must run all test cases of storm windspeed in one execution. Use a sentinel value to terminate the program. Do not assume a specific number of inputs. Determine the maximum storm windspeed value input. Note that the maximum must be evaluated within your program. DO NOT USE BUILT-IN FUNCTIONS. Output screenshot must include values shown below, their calculated typhoon level, and the maximum storm windspeed entered.
Windspeed must be greater than zero. If zero or less, reprompt for the windspeed again.
4
Run your application with the following data and save the screenshots of inputs and outputs to submit.
| Windspeed(MPH) | Typhoon Category |
| <74 | Tropical-storm-not a typhoon |
| 74 to 95 | 1 |
| 96 to 110 | 2 |
| 111 to 130 | 3 |
| 131 to 155 | 4 |
| 156 or more | 5 |
Solution
solution
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace ConsoleApplication8
{
class Program
{
static void Main(string[] args)
{
Console.WriteLine(\"enter the sentinal value 999 to exit the program\");
int sentinalvalue = Convert.ToInt32( Console.ReadLine());
while(sentinalvalue!=999)
{
Console.WriteLine(\"enter the windspeed in mph to determine the typhoon category\");
int stromspeed = Convert.ToInt32(Console.ReadLine());
while(stromspeed<=0)
{
Console.WriteLine(\"enter the windspeed greater than zero\");
stromspeed = Convert.ToInt32(Console.ReadLine());
}
if (stromspeed > 0 & stromspeed < 74)
{
Console.WriteLine (\"typhoon category is normal or not a typhoon\");
}
else if (stromspeed >= 74 & stromspeed <= 95)
{
Console.WriteLine(\"typhoon category is one\");
}
else if (stromspeed > 95 & stromspeed <= 110)
{
Console.WriteLine(\"typhoon category is two\");
}
else if (stromspeed > 110 & stromspeed <= 130)
{
Console.WriteLine (\"typhoon category is three\");
}
else if (stromspeed > 131 & stromspeed <= 155)
{
Console.WriteLine(\"typhoon category is four\");
}
else if (stromspeed >= 156)
{
Console.WriteLine(\"typhoon category is five\");
}
Console.WriteLine(\"enter the sentinal value 999 to exit the program, to continue press any number\");
sentinalvalue = Convert.ToInt32(Console.ReadLine());
}
Console.ReadKey();
}
}
}
output
enter the sentinal value 999 to exit the program
36
enter the windspeed in mph to determine the typhoon category
15
typhoon category is normal or not a typhoon
enter the sentinal value 999 to exit the program, to continue press any number
6
enter the windspeed in mph to determine the typhoon category
56
typhoon category is normal or not a typhoon
enter the sentinal value 999 to exit the program, to continue press any number
6
enter the windspeed in mph to determine the typhoon category
859
typhoon category is five
enter the sentinal value 999 to exit the program, to continue press any number
5
enter the windspeed in mph to determine the typhoon category
145
typhoon category is four
enter the sentinal value 999 to exit the program, to continue press any number
999

