C# programming Create an application that prompts the user for a storm windspeed
ID: 3797356 • Letter: C
Question
C# programming
Create an application that prompts the user for a 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. You MAY NOT use C built in function. Output screenshot must include the input values shown below, their calculated typhoon level and the maximum storm wind speed entered Wind speed must be greater than zero. If zero or less, reprompt for that windspeed again Windspeed mph) hoon category 74 Tropical storm-not a typhoon 74 to 95 96 to 110 111 to 130 131 to 155 156 or more Run your application with the following data and save the screenshot of inputs and outputs to submit. Storm MPHExplanation / Answer
Code:
using System.IO;
using System;
using System.Collections.Generic;
class Program
{
static void Main()
{
Console.WriteLine("Hello, World!");
string input;
int value;
List<int> myList = new List<int>();
Console.WriteLine("Enter windspeed in mph(To exit type any character)");
input=Console.ReadLine();
while(int.TryParse(input ,out value))
{
if(value>0)
myList.Add(value);
Console.WriteLine("Enter windspeed in mph(To exit type any character)");
input=Console.ReadLine();
}
int max=0;
foreach (int i in myList)
{
//Console.WriteLine("i is {0}",i);
if(i>max)
max=i;
}
Console.WriteLine("Storm MPH");
foreach (int i in myList)
{
if(i<74)
Console.WriteLine("Tropical-storm not a typhoon {0}",i);
else if(i>= 74 && i<=95)
Console.WriteLine("1 {0}",i);
else if(i>=96 && i<=110)
Console.WriteLine("2 {0}",i);
else if(i>=111 && i<=130)
Console.WriteLine("3 {0}",i);
else if(i>=131 && i<=155)
Console.WriteLine("4 {0}",i);
else if(i>=156)
Console.WriteLine("5 {0}",i);
}
Console.WriteLine("The max value entered is {0}", max);
}
}
Output:
Enter windspeed in mph(To exit type any character)
74
Enter windspeed in mph(To exit type any character)
70
Enter windspeed in mph(To exit type any character)
-175
Enter windspeed in mph(To exit type any character)
75
Enter windspeed in mph(To exit type any character)
131
Enter windspeed in mph(To exit type any character)
111
Enter windspeed in mph(To exit type any character)
p
Storm MPH
Tropical-storm not a typhoon 70
1 74
1 75
4 131
3 111
The max value entered is 131
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.