Programming Problem 2 in Chapter 5 asked you write a C++ program that asks the u
ID: 3540079 • Letter: P
Question
Programming Problem 2 in Chapter 5 asked you write a C++ program that asks the user to enter his or her weight and the name of a planet. In Chapter 7, Programming Problem 2 asked you to rewrite the program using a Switch statement. Now, rewrite the program so it uses an enumerated type to represent the planet. For ease of reference, the information for the original problem is repeated here. The following table gives the factor by which the weight must be multiplied for each planet. The program should output an error message if the user doesn't input a correct planet name. The prompt and the error message should make it clear to the user how a planet name must be entered. Be sure to use proper formatting and appropriate comments in your code. The output should be labeled clearly and formatted neatly. Mercury 0.4155 Venus 0.8975 Earth 1.0 Moon 0.166 Mars 0.3507 Jupiter 2.5374 Saturn 1.0677 Uranus 0.8947 Neptune 1.1794 Pluto 0.0899
I am trying to use (enum) to do the work, but not sure how to without using (else or case). Maybe I misunderstood the question. I am lost.
Explanation / Answer
please see here..
http://pastebin.com/AJUEaaYP
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.