Question #307570

The Saffir-Simpson Hurricane Scale classifies hurricanes into five categories numbered 1 to 5.


Write a program that outputs a hurricane’s category based on the user’s input of the wind speed.


You may assume that wind speeds will be provided as integer values.


The categories are as follows:



252 km/h or higher-- 5


209 – 251 km/h --4


178 – 208 km/h --3


154 – 177 km/h-- 2


119 – 153 km/h --1



Any storm with winds of less than 119 km/h is not a hurricane


Expert's answer

using System;




namespace HurricaneScale

{

  class Program

  {

    static void Main(string[] args)

    {

      int WindSpeed = -1;

      Console.WriteLine("Enter the wind speed");

      WindSpeed = int.Parse(Console.ReadLine());

      if (WindSpeed < 119)

        Console.WriteLine("Storm with winds of less than 119 km/h is not a hurricane");

      if (WindSpeed >= 119 && WindSpeed <= 153)

        Console.WriteLine("1");

      if (WindSpeed >= 154 && WindSpeed <= 177)

        Console.WriteLine("2");

      if (WindSpeed >= 178 && WindSpeed <= 208)

        Console.WriteLine("3");

      if (WindSpeed >= 209 && WindSpeed <= 251)

        Console.WriteLine("4");

      if (WindSpeed >= 252)

        Console.WriteLine("5");

    }

  }

}

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

LATEST TUTORIALS
APPROVED BY CLIENTS