DrJava Earthquakes Inc. has hired you to write a program to put out bulletins in
ID: 3650766 • Letter: D
Question
DrJavaEarthquakes Inc. has hired you to write a program to put out bulletins in the event of an earthquake. Write an application that prompts for and takes as input a Richter scale number and prints out a characterization based on that value. Use the following table.
Richter Scale Number: Characterization:
n < 5.0 Shaking but no damage.
5.0 ? n < 6.0 Moderate damage.
6.0 ? n < 7.0 Damaging to most buildings.
7.0 ? n < 8.0 Most buildings collapse partially or completely.
higher Devastating in large area.
Explanation / Answer
Please rate...
Program Earthquake.java
====================================================
import java.util.Scanner;
class Earthquake
{
public static void main(String args[])
{
Scanner s=new Scanner(System.in);
System.out.print("Enter the Richter Scale number: ");
double r=s.nextDouble();
if(r<5.0)System.out.println("Shaking but no damage");
if(r>=5.0 && r<6.0)System.out.println("Moderate damage");
if(r>=6.0 && r<7.0)System.out.println("Damaging to most buildings");
if(r>=7.0 && r<8.0)System.out.println("Most buildings collapse partially or completely. " +
"higher Devastating in large area. ");
}
}
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.