Write a c++ program that will allow a user to enter a number between 10 and 30.
Question:
Write a c++ program that will allow a user to enter a number between 10 and 30. If the number is outside the range, output “An invalid number has been entered.”, then end the program. If a valid number has been entered, allow a user to enter a code of A, B, or C. If an invalid code is enter, output “An invalid code has been entered.”, then end the program. Using the value 28.82, if the number entered is between 10 and 20, and code equals ‘A’, add 5 to the decimal value( ex: 2.2 + 5 = 7.2). If the number entered is between 19 and 30, and the code equals ‘B’, add 10 to the decimal value. If the number entered is between 19 and 30, and the code equals ‘C’, add 100 to the decimal value( ex: 2.2 + 5 = 7.2). All other criteria is invalid and you should output “Invalid criteria.”
Once decimal value is computed, output all on a new line, the number entered, the code entered and the computed value and end the program.
Java An Introduction To Problem Solving And Programming
ISBN: 9780134462035
8th Edition
Authors: Walter Savitch