PA 8-1 (25 points) One use of while
or do-while loops is to allow a user to choose whether to run a section of code
or entire program again or not. Write a program that asked the user to enter
'y' or 'Y', to have the program you wrote for PA7-1 run again, or 'n' or 'N',
to have the program exit. This use of while and do-while loops allows the user
to process an indefinite number of transactions. Assume the user enters the correct upper case letters where appropriate.
PA 8-2 (25 points) In this exercise you will use a do-while loop to allow users more than one attempt to input entries correctly. Write a program that asks the user for day of the month (1-31), then month of the year (1-12), and year (2000 – 2050). If the user makes entries that are not permitted, i.e. month number greater than 12, allow them to try again. Output their entries in this format, 5/10/2020, meaning October 5, 2020. While not necessary to you to code, an appropriate improvement of this program would be to make sure that ranges for the day of the month would be tailored for each month, June (month 6) would be limited to 1-30, February to 1-28 or 1-29, depending on the year, etc. Hint: Set a flag, continue loop while flag is set. Use if statement to check user entry and change flag to exit loop when user makes correct entry. Don't forget to initialize the flag before entering a loop and the difference between = and ==.