PA 8-3 (25 points) You must complete this exercise to successfully complete PA9-4. In this exercise you are going to create a program in which a while or do-while loop will stop when some desired...


PA 8-3
(25 points) You must complete this exercise to successfully complete PA9-4. In this exercise you are going to create a program in which a while or do-while loop will stop when some desired result in your program is reached. When rolling a pair of dice there are 36 possible outcomes; in 6 of the possible outcomes the same value is shown on each die. These are called "doubles". Write code in which two dice are rolled until "doubles" are gotten. Display the number of rolls and the value of each die.


Programming Assignment 8 (PA 8) Due Oct 9 75 points 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 ==. PA 8-3 (25 points) You must complete this exercise to successfully complete PA9-4. In this exercise you are going to create a program in which a while or do-while loop will stop when some desired result in your program is reached. When rolling a pair of dice there are 36 possible outcomes; in 6 of the possible outcomes the same value is shown on each die. These are called "doubles". Write code in which two dice are rolled until "doubles" are gotten. Display the number of rolls and the value of each die. Self-Evaluation for Your name Expected Score: ??/75 Problem No. Did not attempt or, attempted but did not compile Compiled but had runtime errors Ran without runtime errors, but with incorrect outputs Perfect outputs for all situations Works perfectly and has been extended beyond requirements PA 8-1 (25) PA 8-2 (25) PA 8-3 (25)
Oct 09, 2021
SOLUTION.PDF

Get Answer To This Question

Related Questions & Answers

More Questions »

Submit New Assignment

Copy and Paste Your Assignment Here