Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Write a program which implements a dice game. The aim of the game is to reach a score as close as possible to 100 (but

image text in transcribed

Write a program which implements a dice game. The aim of the game is to reach a score as close as possible to 100 (but not over 100) in three rounds. Each round consists of throwing five random dice, the user then chooses two of the dice values where the two dice values chosen form a two digit score which is added to the user's current total, e.g., if the user first chooses a dice with the value 3 and then a dice with the value 5, 35 is added to the user's total (the first dice chosen is the tens digit and the second dice chosen is the units digit). The random dice are displayed with one space between each dice, e.g. Your dice: 3 5 3 4 1 and to choose the dice the user enters a number 1, 2, 3, 4 or 5 indicating which of the five dice they wish to choose, i.e., the position of the dice (not the value of the dice). This process is repeated three times. Below is the statement which initialises the user's current score: current total 0 Copy this statement into your program. Over the page are two example outputs using the completed program (the user input is shown in a larger pink font). Your program must give the output in the same format as the outputs in the two examples below. Note that the top string of symbols has a length of 45 and the bottom string of" symbols has a length of 21. REACH 100 IN THREE ROUNDS! Initial total: 0 Round 1 Your dice: 3 1 4 4 6 Tens? 3 Units? 5 REACH 100 IN THREE ROUNDSInitial total: 0 Dice value: 46 Round1 Your dice: 3 5 3 4 1 Your current total: 46 Tens? 2 Units? 4 Round 2 Your dice: 3 5 5 4 5 Dice value: 54 Tens?1 Units? 2 Your current total: 54 Dice value: 35 Round 2 Your dice: 3 2 3 1 6 Your current total: 81 Tens? 1 Units? 5 Round3 Your dice: 6 3 1 3 6 Dice value: 36 Tens? 3 Units? 1 Your current total: 90 Dice value: 16 Round3 Your dice: 4 4 2 4 2 Tens? 3 Units? 5 Your final score: 97 Dice value: 22 Your final score 112

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

Bioinformatics Databases And Systems

Authors: Stanley I. Letovsky

1st Edition

1475784058, 978-1475784053

More Books

Students also viewed these Databases questions

Question

What is conservative approach ?

Answered: 1 week ago

Question

What are the basic financial decisions ?

Answered: 1 week ago