1. Write a program which simulates rolling dice. It should: Display the random number rolled Ask the...
Fantastic news! We've Found the answer you've been seeking!
Question:
1. Write a program which simulates rolling dice. It should:
- Display the random number rolled
- Ask the user if they want to roll again. If they don't want to roll again, the program should end. If they do want to roll again, the new number should display.
- At a minimum, the die should have 6 sides, but if you want to use a d12 or d20, that is fine too.
2. Write a program which gives an easy mathematics quiz. The program should display two random numbers which are to be added together, like this:
117 + 213 -----
The program should ask the user to enter their answer. If the answer is correct, the user should be congratulated. If the answer is wrong, the right answer should be displayed and the user should be scolded. Don't forget to:
- Generate random numbers
- Ask the user if they want to be tested again. If they don't want another math problem, the program should end. If they do want to try again, the new problem should display.
Helpful hint: don't forget about input validation loops. They are very useful when used in conjuction with functions.
Related Book For
Java How To Program Late Objects Version
ISBN: 9780136123712
8th Edition
Authors: Paul Deitel, Deitel & Associates
Posted Date: