
Explanation of Solution
The earthquake program is as follows:
File name: “Earth.java”
//Create a class
public class Earth
{
//Declare the variable
private double mag;
//Define the constructor
public Earth(double magnit)
{
//Assign the magnitude value
mag = magnit;
}
//Define a method "getDesc()"
public String getDesc()
{
//Declare the variable for magnitude description
String desc;
/*Check whether the value of magnitude is greater than or equal to "8.0" */
if (mag >= 8.0)
{
//Assign the description
desc = "Most structures fall";
}
/*Check whether the value of magnitude is greater than or equal to "7.0" */
else if (mag >= 7.0)
{
//Assign the description
desc = "Many buildings destroyed";
}
/*Check whether the value of magnitude is greater than or equal to "6.0" */
else if (mag >= 6.0)
{
//Assign the description
desc = "Many buildings considerably damaged, some collapse";
}
/*Check whether the value of magnitude is greater than or equal to "4.5" */
else if (mag >= 4...

Want to see the full answer?
Check out a sample textbook solution
Chapter 5 Solutions
Big Java, Binder Ready Version: Early Objects
- Database System ConceptsComputer ScienceISBN:9780078022159Author:Abraham Silberschatz Professor, Henry F. Korth, S. SudarshanPublisher:McGraw-Hill EducationStarting Out with Python (4th Edition)Computer ScienceISBN:9780134444321Author:Tony GaddisPublisher:PEARSONDigital Fundamentals (11th Edition)Computer ScienceISBN:9780132737968Author:Thomas L. FloydPublisher:PEARSON
- C How to Program (8th Edition)Computer ScienceISBN:9780133976892Author:Paul J. Deitel, Harvey DeitelPublisher:PEARSONDatabase Systems: Design, Implementation, & Manag...Computer ScienceISBN:9781337627900Author:Carlos Coronel, Steven MorrisPublisher:Cengage LearningProgrammable Logic ControllersComputer ScienceISBN:9780073373843Author:Frank D. PetruzellaPublisher:McGraw-Hill Education





