Vrite a C+ program that prompts the user to enter the earthquake magnitude and utputs its class. We have six classes as follows: 1. MINOR if the magnitude is in [0, 4[, 2. LIGHT if the magnitude is in [4, 5[, 3. MODERATE if the magnitude is in [5, 6[, 4. STRONG if the magnitude is in [6, 7[, 5. MAJOR if the magnitude is in [7, 8[, 6. GREAT if the magnitude is in [8, c¤[. 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
C++ language please
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 if the magnitude is in [0, 4[,
2. LIGHT if the magnitude is in [4, 5[,
3. MODERATE if the magnitude is in [5, 6[,
4. STRONG if the magnitude is in [6, 7[,
5. MAJOR if the magnitude is in [7, 8[,
6. GREAT if the magnitude is in [8, 0ɖ.
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: 1. MINOR if the magnitude is in [0, 4[, 2. LIGHT if the magnitude is in [4, 5[, 3. MODERATE if the magnitude is in [5, 6[, 4. STRONG if the magnitude is in [6, 7[, 5. MAJOR if the magnitude is in [7, 8[, 6. GREAT if the magnitude is in [8, 0ɖ. 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
steps

Step by step

Solved in 3 steps with 1 images

Blurred answer
Knowledge Booster
Data members
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