Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Need to be answered correctly. You must: Comment and Format and Must make sure about indenting. If you don't follow these steps, it will be

Need to be answered correctly. You must: Comment and Format and Must make sure about indenting. If you don't follow these steps, it will be flagged for review. MUST BE IN JAVA FORMAT. IT IS A MUST. Please also check the output very carefully. There is spacing in the output which must be maintained between each guesses. Plus, the output should generate: CONGRATULATIONS! You win the Super Lottery! $1000! even after 3 rounds????????

image text in transcribed

image text in transcribed

image text in transcribed

Need to be answered correctly. You must: Comment and Format and Must make sure about indenting. If you don't follow these steps, it will be flagged for review. MUST BE IN JAVA FORMAT. IT IS A MUST. Please also check the output very carefully. There is spacing in the output which must be maintained between each guesses. Plus, the output should generate: CONGRATULATIONS! You win the Super Lottery! $1000! even after 3 rounds????????

Exercise 3. Write a program to play a lottery game. A player gets to play 5 times (per round) to try and guess the super jackpot. The program generates a random two-digit number and prompts the player to input their two-digit guess. The player gets 5 chances in each round of the game. For each guess, the rules to determine the winnings are If the two digits match exactly the random number (in the right order), the player wins the super jackpot (S1000) If the two digits match (but not in the right order), the player wins S10 If one digit matches, the player wins $1 After a round of play (5 turns), print out the total winnings and ask the user if they want to play again (and if so, print the winnings over all rounds and start a new round of play). If they want to stop playing, print the total winnings over all rounds and the best round winnings (e.g., if they play four rounds and round two had the highest winnings, then print those winnings). See below for a description of random number generation. Provide - Printout of properly formatted source code Example output/test cases (2 test cases with at least 3 rounds each different than shown). A sample run Welcome to the Super Lotteryl Let's Playl Round 1 - you have 5 chances to win money Enter your guess: 34 The lottery number is 24 You guessed one number! You win $11 Enter your guess: 21 The lottery number is 12 You guessed both numbers, but in a different order You win $101 Enter your guess: 11 The lottery number is 90 Good luck next time! You still have 2 guesses Enter your guess: 42 The lottery number is 42 CONGRATULATIONS! You win the Super Jackpot $1000! Enter your guess: 22 The lottery number is 26 You guessed one number! You win $1 End of round. You won S1012 Play again? (enter yeso) yes

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Professional SQL Server 2012 Internals And Troubleshooting

Authors: Christian Bolton, Justin Langford

1st Edition

1118177657, 9781118177655

More Books

Students also viewed these Databases questions

Question

What is the most important part of any HCM Project Map and why?

Answered: 1 week ago