Title | ME261 HW07 F16 - hw 7 |
---|---|
Course | Matlab |
Institution | New Mexico State University |
Pages | 1 |
File Size | 106.2 KB |
File Type | |
Total Downloads | 4 |
Total Views | 144 |
hw 7...
ME 261
Homework #7
Fall 2016
________________________________________________________________________________________________________________________________________________________________________
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) n < 5.0 5.0 ≤ n < 5.5 5.5 ≤ n < 6.5 6.5 ≤ n < 7.5 higher
Characterization Little or no damage Some damage Serious damage: walls may crack or fall Disaster: houses and buildings may collapse Catastrophic: most buildings destroyed
Requirement: 1. Must use an if-elseif-…-else structure. 2. Cannot use Logic Operators (program structure should be similar to letter grade example). 3. Read in a value for n using the input command and then display the corresponding characterization message using fprintf. 4. Examples: Enter the earthquake Richter Scale Number: -2 Richter Scale Number must be greater than 0!
Enter the earthquake Richter Scale Number: 6.5 For a Richter Scale Number of 6.50 Earthquake Characterization is: Disaster: houses and buildings may collapse
Enter the earthquake Richter Scale Number: 7.7 For a Richter Scale Number of 7.70 Earthquake Characterization is: Catastrophic: most buildings destroyed...