Question

Hello Can someone help me with this C# problem The Saffir-Simpson Hurricane Scale classifies hurricanes into...

Hello

Can someone help me with this C# problem

The Saffir-Simpson Hurricane Scale classifies hurricanes into five categories numbered 1 through 5. Write an application named Hurricane that outputs a hurricane’s category based on the user’s input of the wind speed.

Category 5 hurricanes have sustained winds of at least 157 miles per hour. The minimum sustained wind speeds for categories 4 through 1 are 130, 111, 96, and 74 miles per hour, respectively.

Any storm with winds of less than 74 miles per hour is not a hurricane.

If a storm falls into one of the hurricane categories, output This is a category # hurricane, with # replaced by the category number.

If a storm is not a hurricane, output This is not a hurricane.

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

The answer to this question is as follows:

The code is as follows:

using System;

class Program
{
  
static void Main() {
int speed,category;
//reading the speed in runtime
speed=Convert.ToInt32(Console.ReadLine());
if(speed>=74 && speed<96)
{
category=1;
}
else if(speed>=96 && speed<111)
{
category=2;
}
else if(speed>=111 && speed<130)
{
category=3;
}
else if(speed>=130 && speed<157)
{
category=4;
}
else if(speed>=157)
{
category=5;
}
else
{
category=-1;
}
  
if(category>0)
{
Console.WriteLine("This is category "+category+" hurricane");
}
else
{
Console.WriteLine("This is not a hurricane");
}
}
}

The input and ouput are provided in the screenshot below:

Add a comment
Know the answer?
Add Answer to:
Hello Can someone help me with this C# problem The Saffir-Simpson Hurricane Scale classifies hurricanes into...
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 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...

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