Previously , you wrote a program named Hurricane that classified hurricanes into five categories using the Saffir-Simpson Hurricane Scale. Now, create a modified version named Hurricane Modularized that passes a user’s input wind speed to a method that returns the hurricane category.

Respuesta :

Answer:

Answer  of the Java class explained below with appropriate comments

Explanation:

using System;

class MainClass {

 public static void Main (string[] args) {

//entering wind speed of the hurricane

   Console.WriteLine ("Enter wind speed in mph: ");

   int windSpeed = Convert.ToInt32(Console.ReadLine());

//checking for the category with the credited wind speed

   int category = GetCategory(windSpeed);

   Console.WriteLine ("Category: " + category);

 }

 public static int GetCategory(int wind) {

     //function for classifying the wind speeds

     if(wind >= 157) {

         

     return 5;

     }

     if(wind >= 130) {

         return 4;

     }

     if(wind >= 111) {

         return 3;

     }

     if(wind >= 96) {

         return 2 ;

     }

     return 1;

 }

}