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 MPH

0 0
Add a comment Improve this question Transcribed image text
Answer #1

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\t\t\t\t\tMPH");
  
foreach (int i in myList)
{
if(i<74)
Console.WriteLine("Tropical-storm not a typhoon\t\t{0}",i);
else if(i>= 74 && i<=95)
Console.WriteLine("1\t\t\t\t\t{0}",i);
else if(i>=96 && i<=110)
Console.WriteLine("2\t\t\t\t\t{0}",i);
else if(i>=111 && i<=130)
Console.WriteLine("3\t\t\t\t\t{0}",i);
else if(i>=131 && i<=155)
Console.WriteLine("4\t\t\t\t\t{0}",i);
else if(i>=156)
Console.WriteLine("5\t\t\t\t\t{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

Add a comment
Know the answer?
Add Answer to:
C# programming Create an application that prompts the user for a storm windspeed in mph, then...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • In MATLAB how do you write a program to determine what type of tropical system and/or...

    In MATLAB how do you write a program to determine what type of tropical system and/or category hurricane a system is depending on the wind speed. For example winds in a tropical system at 35 MPH means that the system is a tropical depression. If the winds are at 50 MPH, then the system is a tropical storm. If the winds are at 100 MPH, the system is a category two hurricane. Also, write a similar program on the Fujita...

  • Write a Java application that prompts the user for pairs of inputs of a product number...

    Write a Java application that prompts the user for pairs of inputs of a product number (1-5), and then an integer quantity of units sold (this is two separate prompts for input values). You must use a switch statement and a sentinel-controlled loop (i.e. a loop that stops execution when an out of range value, such as -1, is input). All 15 items below are for a single purchase. There are five sets of inputs as follows: Product 1    1...

  • Write in JAVA Get Familiar with the Problem Carefully read the program description and look at...

    Write in JAVA Get Familiar with the Problem Carefully read the program description and look at the data file to gain an understanding of what is to be done. Make sure you are clear on what is to be calculated and how. That is, study the file and program description and ponder! Think! The Storm Class Type Now concentrate on the Storm class that we define to hold the summary information for one storm. First, look at the definition of...

  • C Programming Quesition (Structs in C): Write a C program that prompts the user for a...

    C Programming Quesition (Structs in C): Write a C program that prompts the user for a date (mm/dd/yyyy). The program should then take that date and use the formula on page 190 (see problem 2 in the textbook) to convert the date entered into a very large number representing a particular date. Here is the formula from Problem 2 in the textbook: A formula can be used to calculate the number of days between two dates. This is affected by...

  • Your assignment is to create a restaurant ordering system where the cashier can create the menu...

    Your assignment is to create a restaurant ordering system where the cashier can create the menu and then take in the order and display the order back to the customer Sample Execution – Level 1 Welcome to your Menu Creation system. How many items would you like to have on your menu? 2 Create your menu! Enter item #1: Coffee Enter item #2: Tea This is the menu: Coffee Tea What would you like to order? Cake That isn’t on...

  • CODE MUST BE IN C++ Objective Create a program that provides the solution to a quadratic...

    CODE MUST BE IN C++ Objective Create a program that provides the solution to a quadratic equation. Background: A quadratic equation can be generalized by equation below: f ( x )=ax2+ bx +c Closed form solutions can be found for the zeros of a quadratic function conveniently. That is the locations where the function is equal to zero can be found by the following equation: x=− b± √ b −4ac 2a Note that depending on the sign of the expression...

  • This is a C++ assignment that I'm trying to create and would like some help understanding...

    This is a C++ assignment that I'm trying to create and would like some help understanding while loops, with possible integration of for loops and if statements. This program only uses while, for, and if. I have some code that I have started, but where to go from there is what's giving me some trouble. This is involves a sentinel controlled while loop, and there are a lot of specifications below that I must have in the program. The program...

  • This is a C++ assignment that I'm trying to create and would like some help understanding...

    This is a C++ assignment that I'm trying to create and would like some help understanding while loops, with possible integration of for loops and if statements. This program only uses while, for, and if. I have some code that I have started, but where to go from there is what's giving me some trouble. This is involves a sentinel controlled while loop, and there are a lot of specifications below that I must have in the program. The program...

  • This is in c programming using functions in visual studios Carpet Jolb A carpeting company wants...

    This is in c programming using functions in visual studios Carpet Jolb A carpeting company wants to estimate what it will cost a customer to have a room carpeted. They can carpet 65 sq. ft. of room space in 4 hours, and they charge $25.00 per hour as their labor rate Write a program to ask the user for the length of the room (in inches) to be carpeted, the width of the room (in inches) to be carpeted, and...

  • Write a C++ program named, gradeProcessor.cpp, that will do the following tasks: -Print welcome message -Generate...

    Write a C++ program named, gradeProcessor.cpp, that will do the following tasks: -Print welcome message -Generate the number of test scores the user enters; have scores fall into a normal distribution for grades -Display all of the generated scores - no more than 10 per line -Calculate and display the average of all scores -Find and display the number of scores above the overall average (previous output) -Find and display the letter grade that corresponds to the average above (overall...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT