EarthquakeStrength.java.html

  1  import java.util.Scanner;
  2  
  3  /**
  4     This program gives a description of an earthquake, given the Richter scale magnitude.
  5  */
  6  public class EarthquakeStrength
  7  {
  8     public static void main(String[] args)
  9     {  
 10        Scanner in = new Scanner(System.in);
 11        System.out.print("Enter a magnitude on the Richter scale: ");
 12        double richter = in.nextDouble();
 13  
 14        // Print the description
 15  
 16        if (richter >= 8.0)
 17        {
 18           System.out.println("Most structures fall");
 19        }
 20        else if (richter >= 7.0)
 21        {
 22           System.out.println("Many buildings destroyed");
 23        }
 24        else if (richter >= 6.0)
 25        {
 26           System.out.println("Many buildings considerably damaged, some collapse");
 27        }
 28        else if (richter >= 4.5)
 29        {
 30           System.out.println("Damage to poorly constructed buildings");
 31        }
 32        else 
 33        {
 34           System.out.println("No destruction of buildings");
 35        }
 36     }
 37  }
 38