The Richter scale is a way to quantify the magnitude of an earthquake using a ba
ID: 3756040 • Letter: T
Question
The Richter scale is a way to quantify the magnitude of an earthquake using a base-10 logarithmic scale. The magnitude is defined as the logarithm of the ratio of the amplitude of waves measured by a seismograph to an arbitrarily small amplitude. An earthquake that measures 5.0 on the Richter scale has a shaking amplitude 10 times larger than one that measures 4.0, and corresponds to a 31.6 times larger release of energy. [Rephrased from Wikipedia] The energy in joules released for a particular Richter scale measurement is given by: Energy = 10^((1.5*richter)+4.8) where Energy is measured in joules and richter is the Richter scale measurement (typically on a scale from 1-10 as a floating point number). One ton of exploded TNT yields 4.184x10^9 joules. Thus, you can relate the energy released in joules to tons of exploded TNT. You can use the website http://www.convertalot.com/earthquake_power__calculator.html to check work. Here are some famous earthquakes: 9.1 (Indonesia earthquake, 2004) 9.2 (Alaska earthquake, 1964) 9.5 (Chile earthquake, 1960; largest ever measured) This program will perform the appropriate calculations and display the equivalent amount of energy in joules and/or in tons of exploded TNT. Please input a number between 1 and 10 for the Richter scale measurements. In JAVA.
Explanation / Answer
The following code in JAVA should get you going,I have added commentsin the code itself and so it will be relatable:
/* Filename: Main.java */
import java.util.Scanner;
public class Main{
public static void main(String[] args){
double richter;//input variable for richter magnitude
System.out.println("Enter the magnitude of earthquake in richter");
Scanner scan = new Scanner(System.in);
richter = scan.nextDouble() ;
double RichterEnergy=java.lang.Math.pow(10,((1.5*richter)+4.8)); //energy due to earthquake
double TNTEquiv=4.184*1000000000;//equivalent tons of TNT for the eathquake
System.out.println("Energy released in joules = "+RichterEnergy);
System.out.println("Equivalent amount in tons of TNT :"+(RichterEnergy/TNTEquiv));
}
}
Hope this helps :) .
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.