Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Computer Science Name_______________ Hurricane Lab Objective: To learn how to us

ID: 3581104 • Letter: C

Question

Computer Science                                                                 Name_______________

Hurricane Lab

Objective: To learn how to use the logical operators of the Java programming language

Tropical storms are classified as hurricanes based on their wind speeds and storm surges. Generally, a minimum hurricane has sustained winds of at least 74 miles per hour (mph). A storm that is a hurricane can be further classified using different categories. The Saffir/Simpson scale for classifying hurricanes is shown below:

Category

Definitions and Effects

1

Sustained winds of 74-93 mph

Damage primarily to unanchored mobile homes, shrubbery, and trees.

2

Sustained winds of 94-110 mph

Damage to roofing materials, windows, and doors .

3

Sustained winds of 111-130 mph

Structural damage, mobile homes destroyed, flooding near coastline

4

Sustained winds of 131-155 mph

Major erosion of beach areas, major damage to lower floors of structures near the shore.

5

Sustained winds above 155 mph

Complete roof failure on many residences and industrial buildings. Massive evacuation required.

Copy the following code into a jGrasp window. Write the body of the method classifyHurricane to decide which category the hurricane belongs to and return an appropriate message. Once you get your code to work, ask the programmer how many values they would like to enter and then repeat this code the appropriate number of times.

import java.util.Scanner;

public class Hurricane{
   public static void main(String [] args){
      Scanner input = new Scanner(System.in);
      int wind;
      
      System.out.println("Enter your wind speed ");
      wind = input.nextInt();
      System.out.println(classifyHurricane(wind));
       
   }
   public static String classifyHurricane (int wind)
   {
     
   }
  
}

Category

Definitions and Effects

1

Sustained winds of 74-93 mph

Damage primarily to unanchored mobile homes, shrubbery, and trees.

2

Sustained winds of 94-110 mph

Damage to roofing materials, windows, and doors .

3

Sustained winds of 111-130 mph

Structural damage, mobile homes destroyed, flooding near coastline

4

Sustained winds of 131-155 mph

Major erosion of beach areas, major damage to lower floors of structures near the shore.

5

Sustained winds above 155 mph

Complete roof failure on many residences and industrial buildings. Massive evacuation required.

ooooo Sp Write a class called Student using the following UML diagram. Here is additional information to help you with your code, I. A student has a name a three test scores. 2. The no argument constructor should initialize the student's to the empty string and the test scores to zero. The method setScore(int i, int score) should set test i to the 4, The method getscore(int should retrieve the score for test i. 5. The method getAverage0 should compute and retum the average of the 3 tests. 6. The method getHigh Score0 should determine and retum the 7. The tostring method. The string should include the studem's name and the 3 test scores. For example, Test 3: 88 write a class called Testsoadent. This class should contain amain and statements to perform the following tasks 14, and RR. a Mudent named Bob with lest soores or83, 2. Print out Bob's information. and print out the Calculate the average Bob's test scores 4 create a second student named Nll with test scores of 70,82, Print out Jill's should have 6 Ms Cubeta miss graded Jill's third test. Her score been 91. Change Jill's third Calculate Jill'shighest test score and print out the result. lf your program works correctly hereis the output you should see Test 2:74 Test 3:88 Bob's average score is 81.66666666666667 Test 2- Jill's highest test score is 91 77%

Explanation / Answer

HI, Please find my implementation:

import java.util.Scanner;

public class Hurricane{

   public static void main(String [] args){

       Scanner input = new Scanner(System.in);

       int wind;

       System.out.println("Enter your wind speed ");

       wind = input.nextInt();

       System.out.println(classifyHurricane(wind));

   }

   public static String classifyHurricane (int wind)

   {

      

       if(wind >= 74 && wind <=93){

           return "Sustained winds of 74-93 mph "+

                   "Damage primarily to unanchored mobile homes, shrubbery, and trees.";

       }

       else if(wind >= 94 && wind <=100){

           return "Sustained winds of 94-110 mph "+

                   "Damage to roofing materials, windows, and doors .";

       }else if(wind >= 111 && wind <=130){

           return "Damage to roofing materials, windows, and doors . "+  

                   "Structural damage, mobile homes destroyed, flooding near coastline";

          

       }else if(wind >= 131 && wind <=155){

           return "Sustained winds of 131-155 mph "+

                   "Major erosion of beach areas, major damage to lower floors of structures near the shore.";

       }else if(wind > 155){

           return "Sustained winds above 155 mph "+

       "Complete roof failure on many residences and industrial buildings. Massive evacuation required.";

       }else{

           return "Wind speed should be at least 74 mph!!!";

       }

   }

}

/*

Sample run:

Enter your wind speed

113

Damage to roofing materials, windows, and doors .

Structural damage, mobile homes destroyed, flooding near coastline

*/

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote