Write a C++ program that prompts the user to enter the earthquake magnitude and outputs its class. We have six classes as follows: 1. MINOR 2. LIGHT if the magnitude is in [0, 4[, if the magnitude is in [4, 5[, 3. MODERATE if the magnitude is in [5, 6[, if the magnitude is in [6, 7[, if the magnitude is in [7, 8[, if the magnitude is in [8, o[. 4. STRONG 5. MAJOR 6. GREAT For instance, if the user enters a magnitude of 5.5, the program should output "MODERATE". If the user enters a magnitude of 6, the program should output STRONG. If the user enters a negative value, the program should output the following text: "This is not a valid magnitude value" Hint: use nested if-else statement.

C++ Programming: From Problem Analysis to Program Design
8th Edition
ISBN:9781337102087
Author:D. S. Malik
Publisher:D. S. Malik
Chapter9: Records (struct)
Section: Chapter Questions
Problem 2PE
icon
Related questions
Question
Write a C++ program that prompts the user to enter the earthquake magnitude and outputs its class.
We have six classes as follows:
if the magnitude is in [0, 4[,
if the magnitude is in [4, 5[,
1. MINOR
2. LIGHT
3. MODERATE if the magnitude is in [5, 6[,
4. STRONG
5. MAJOR
6. GREAT
if the magnitude is in [6, 7[,
if the magnitude is in [7, 8[,
if the magnitude is in [8, co[.
For instance, if the user enters a magnitude of 5.5, the program should output
"MODERATE". If the user enters a magnitude of 6, the program should output STRONG.
If the user enters a negative value, the program should output the following text: "This is not
a valid magnitude value"
Hint: use nested if-else statement.
Transcribed Image Text:Write a C++ program that prompts the user to enter the earthquake magnitude and outputs its class. We have six classes as follows: if the magnitude is in [0, 4[, if the magnitude is in [4, 5[, 1. MINOR 2. LIGHT 3. MODERATE if the magnitude is in [5, 6[, 4. STRONG 5. MAJOR 6. GREAT if the magnitude is in [6, 7[, if the magnitude is in [7, 8[, if the magnitude is in [8, co[. For instance, if the user enters a magnitude of 5.5, the program should output "MODERATE". If the user enters a magnitude of 6, the program should output STRONG. If the user enters a negative value, the program should output the following text: "This is not a valid magnitude value" Hint: use nested if-else statement.
Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 3 steps with 1 images

Blurred answer
Knowledge Booster
ADT and Class
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
C++ Programming: From Problem Analysis to Program…
C++ Programming: From Problem Analysis to Program…
Computer Science
ISBN:
9781337102087
Author:
D. S. Malik
Publisher:
Cengage Learning