Answer to Question #251873 in C++ for gie

Question #251873

Machine Problem: The National Earthquake Information Center has asked you to write 

   a program implementing the following decision table 

   to characterize an earthquake based on its Richter scale number: 

   Richter Scale Number (n)    Characterization

       n < 5.0                  Little or no damage 

       5.0 <= n < 5.5           Some damage 

       5.5 <= n < 6.5           Some damage; walls may crack or fall 

       6.5 <= n < 7.5           Disaster: houses and buildings may collapse 

       higher                   Catastrophe:  Most buildings destroye




1
Expert's answer
2021-10-16T01:44:09-0400

Source code



#include <iostream>


using namespace std;


int main()
{
    double n;
    cout<<"\nEnter Richter Scale Number (n): ";
    cin>>n;
    if (n<5.0)
        cout<<"\nLittle or no damage";
    else if (n>=5.0 && n<5.5)
        cout<<"\nSome damage";
    else if (n>=5.5 && n<6.5)
        cout<<"\nSome damage; walls may crack or fall ";
    else if (n>=6.5 && n<7.5)
        cout<<"\nDisaster: houses and buildings may collapse ";
    else if (n>7.5)
        cout<<"\nCatastrophe:  Most buildings destroyed ";


    return 0;
}

Sample Output





Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS