Ask Question
16 April, 16:40

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.

+1
Answers (1)
  1. 16 April, 16:57
    0
    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;

    }

    }
Know the Answer?
Not Sure About the Answer?
Find an answer to your question 👍 “Previously, you wrote a program named Hurricane that classified hurricanes into five categories using the Saffir-Simpson Hurricane Scale. ...” in 📗 Engineering if the answers seem to be not correct or there’s no answer. Try a smart search to find answers to similar questions.
Search for Other Answers