Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Write a program FirstToFive that simulates a head-to-head match where two players, Daniel and Johnny, each roll a pair of 6-sided dice. They will

image text in transcribedimage text in transcribed

Write a program FirstToFive that simulates a head-to-head match where two players, Daniel and Johnny, each roll a pair of 6-sided dice. They will continue to roll the dice until the first person wins 5 rounds. A round is won if the player has a higher combined roll than the other player, unless a pair of 1s is rolled. If a player rolls snake eyes (1+1), that player wins the round. If both players's combined roll is the same, the round ends in a tie. Your program must display the details of each round: each player's roll and the result of the round (the winner's name or tie). After the game is over, display the number of wins for each player and the final overall winner. Sample output: Daniel Johnny Round Winner 1 +5 4 +4 Johnny 2 +4 4 +3 Johnny 4+ 5 1 +6 Daniel 5 + 1 6 +3 Johnny 3 +2 1 +4 1+4 25 5+6 5 +1 Tie Johnny Daniel

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

Ethical Obligations and Decision Making in Accounting Text and Cases

Authors: Steven Mintz, Roselyn Morris

4th edition

978-1259543470, 1259543471, 978-1259730191

More Books

Students also viewed these Accounting questions