Question

In: Computer Science

I have an issue this project Background The intensity of a hurricane is classified according to...

I have an issue this project

Background

The intensity of a hurricane is classified according to the Saffir-Simpson hurricane wind scale. The scale together with wind classifications of lower intensities is shown below:

Hurricane Wind Scale Classification

Wind Speed Range (MPH)

Not in scale

0 – 38 mph

Tropical storm

39 – 73 mph

Category One Hurricane

74 – 95 mph

Category Two Hurricane

96 – 110 mph

Category Three Hurricane

111 – 129 mph

Category Four Hurricane

130 – 156 mph

Category Five Hurricane

157 mph or more

Assignment

Write a Java program that asks the user to enter the wind speed. Use a series of nested if statements to determine the intensity of the storm using the above table. Output your result.

Validate your input to check for (invalid) negative wind speeds. For invalid wind speeds – output the classification: Invalid input.

Be sure to include a comment with your name, date, and a short description of the program.

Begin your program as follows:

import java.util.Scanner;

// TODO - add name, date, and purpose of program here
public class Main {

    public static Scanner input = new Scanner(System.in);

    public static void main(String[] args) {
       long speed;
       String classification;
        // TODO - write your program here
   
}
}

Example Output

Enter wind speed (mph): 129

Classification: Category Three Hurricane

Additional Information

Do not include unnecessary if statements or unnecessary logical AND/OR clauses in your code.

should be written:

else if (speed <= 73) { // checking for category 2

My code

mport java.util.Scanner;
public class Main
{
public static Scanner input = new Scanner(System.in);
  
public static void main(String[] args) {
long speed;
String classification="";
System.out.println("Enter wind speed (mph): ");
speed= Main.input.nextLong();
if (speed >= 0 && speed <= 38) {// cheking for category 1
classification="Not in scale";
}
else if (speed >= 39 && speed <= 73) {// cheking for category 2
classification="Topical storm";
}
else if (speed >= 74 && speed <= 95) {// cheking for category 3
classification="Category One Hurricane";
}
else if (speed >= 96 && speed <= 110) {// cheking for category 4
classification="Category Two Hurricane";
}
else if (speed >= 111 && speed <= 129) {// cheking for category 5
classification="Category Three Hurricane";
}
else if (speed >= 130 && speed <= 156) {// cheking for category 6
classification="Category Four Hurricane";
}
else if (speed >= 157) {// cheking for category 7
classification="Category Five Hurricane";
}
if(speed>=0)
{
System.out.print("Category is "+classification);
}
else
{
System.out.println("Invalid input.");
}
}
}

Solutions

Expert Solution

ANSWER:-

// NOTE : I removed all unnecessary if ,else statement. program working fine.if any doubt please comment

import java.util.Scanner;
public class Main
{
public static Scanner input = new Scanner(System.in);
  
public static void main(String[] args) {
long speed;
String classification="";
System.out.println("Enter wind speed (mph): 129");
speed= Main.input.nextLong();
if(speed>=0)
{
   if(speed<=38) // checking for category 1
   {
       classification="Not in scale";
   }
   else if(speed<=73) // checking for category 2
   {
       classification="Topical storm";
   }
   else if(speed<=95) // checking for category 3
   {
       classification="Category One Hurricane";
   }
   else if(speed<=110) // checking for category 4
   {
       classification="Category Two Hurricane";
   }
   else if(speed<=129) // checking for category 5
   {
       classification="Category Three Hurricane";
   }
   else if(speed<=156) // checking for category 6
   {
       classification="Category Four Hurricane";
   }
   else if (speed >= 157) { // checking for category 7
classification="Category Five Hurricane";
   }
   System.out.print("Classification: "+classification);
}
else
System.out.print("Classification: Invalid input.");
}
}

// OUTPUT


Related Solutions

I have an issue this project Background The intensity of a hurricane is classified according to...
I have an issue this project Background The intensity of a hurricane is classified according to the Saffir-Simpson hurricane wind scale. The scale together with wind classifications of lower intensities is shown below: Hurricane Wind Scale Classification Wind Speed Range (MPH) Not in scale 0 – 38 mph Tropical storm 39 – 73 mph Category One Hurricane 74 – 95 mph Category Two Hurricane 96 – 110 mph Category Three Hurricane 111 – 129 mph Category Four Hurricane 130 –...
QUESTION I Project Background You have just completed a postgraduate diploma in project management and are...
QUESTION I Project Background You have just completed a postgraduate diploma in project management and are currently registered for a master’s degree where you have to carry out a mini research on customer care in your organization. Develop a project proposal on the planning, execution, analysis and reporting of the research. All processes planned for should be finalized within 6 months from the 4th august 2018. GENERAL PROJECT TASK The following needs to be done: You know:  How to...
I.- QUESTION Based on several studies, a company has classified, according to the possibility of discovering...
I.- QUESTION Based on several studies, a company has classified, according to the possibility of discovering petroleum, the geological formations in three types: I, II and III. The company intends to drill a well in a certain site that is assigned the probabilities of 0,35; 0, 40 and 0, 25 for the three types of formations, respectively. According to experience, it is known that oil is found in 40% of type I formations, 20% of type II formations and 30%...
(please i need the answer asap )Computer chips defects are classified according to type of defect...
(please i need the answer asap )Computer chips defects are classified according to type of defect and shift on which it was made. The numbers of defects are recorded in the the table below. Do the data present sufficient evidence to indicate that the type of computer chip defect varies with the shift during which they are produced? Test at the 5% level of significance. Shift Type 1 2 3 TOTAL A 14 25 32 71 B 20 30 16...
7. Employees of a local university have been classified according to gender and job type as...
7. Employees of a local university have been classified according to gender and job type as shown below. Job Male (M) Female (F) Faculty (FA) 110 10 Salaried staff (SS) 30 50 Hourly staff (HS) 60 40 (A) If an employee is selected at random what is the probability that the employee is male? (B) If an employee is selected at random what is the probability that the employee is male and salaried staff? (C) If an employee is selected...
I have a CSV file with 6 column Issue id action id Issue category Issue date...
I have a CSV file with 6 column Issue id action id Issue category Issue date Issue Closed Date Issue Type Please write a code in Python that counts the number of issues in each category and the earliest and latest issue date for each category. Example of csv Issue id action id Issue category Issue date Issue Closed Date Issue Type 23 1 Noise Complaint 7/19/2020 7/22/2020 Client Complaint 24 1 Cleanliness Complaint 7/19/2020 7/23/2020 Sanitation 25 2 Site...
I have a project to do, but I have gone through kaggle to look for the...
I have a project to do, but I have gone through kaggle to look for the datset. Kindly help me for a dataset that I can do all these processes: 1. Data Cleaning, 2. Data exploration 3. Principal component analysis 4. Multiple linear regression 5. Predictive Analsysis using MSE, Lasso, ridge, and AIC and BIC test KNE model ETC. please help me with the dataset. I will do the work for myself. The dataset can either be on economy, health,...
Complete the following sentence - A project issue is anything that could have an …… effect...
Complete the following sentence - A project issue is anything that could have an …… effect on the project A Beneficial B Detrimental C Either detrimental or beneficial D Adverse Which of the following activities is not a key point in the management of risk flow? A Authorize the Project B Updating the Business Case C Plan the next Stage D Capture and examine issues and Risks Which of the following processes should cover the first aspect of project quality...
I have a question. I am doing revenue report project. I have to write an efficient...
I have a question. I am doing revenue report project. I have to write an efficient and effeictive means of testing the control. For payment control, the related assertion is Accuray, and Completeness. Possible test of effectiveness is observe card and cash transaction procedures from start to finish. I can't come up with any other effectivness. Please help me. Thanks.
I have a project where i have to include solar cells and piezoelectric transducers in an...
I have a project where i have to include solar cells and piezoelectric transducers in an umbrella. They will be used to transform solar energy and energy from rain respectively into electrical energy. (stored in a lithium battery) I would like to know how i should build up the circuit. As in: 1. should i connect the solar cells in series? 2. How do i connect the piezoelectric transducers? what type of rectifying diode i need for this experiement. 3....
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT