Reference no: EM132356393
Exercise: Undergraduate class status
Topics - Program control while loop, input validation while loop, selection statements
1. Write a program that takes a number of credit hours and returns a classification as follows: 29 credits or less: freshman; 30-59 credits: sophomore; 60-89 credits: junior; 90+ credits: senior.
2. Use a loop to valid input such that users can only enter positive numbers.
3. Use a loop to allow the user to keep entering credit hours and receiving classifications until they quit.
Sample run:
Hi and welcome to the undergraduate classification program.
Would you like to continue (Y/N)? Y
Enter the number of credits earned: 94
Classification: Senior
Would you like to continue (Y/N)? Y
Enter the number of credits earned: -80
Invalid input. Enter the number of credits earned: 80
Classification: Junior
Would you like to continue (Y/N)? N
Have a great day!