Ask Question
10 October, 22:21

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.

+4
Answers (1)
  1. 11 October, 02:11
    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 you're in doubt about the correctness of the answers or there's no answer, then try to use the smart search and find answers to the similar questions.
Search for Other Answers