logo Use SA10RAM to get 10%* Discount.
Order Now logo

Ask This Question To Be Solved By Our ExpertsGet A+ Grade Solution Guaranteed

expert
Daniels FarmerSociology
(5/5)

995 Answers

Hire Me
expert
Lee MackEconomics
(5/5)

651 Answers

Hire Me
expert
Isaac TorresData mining
(4/5)

540 Answers

Hire Me
expert
Sumit DabraPhilosophy
(5/5)

960 Answers

Hire Me
C++ Programming

You have to implement three classes, namely Player class, Dice class, and Game class, and a driver program test class

INSTRUCTIONS TO CANDIDATES
ANSWER ALL QUESTIONS

Write a C++ program to implement a three-player dice game with the following rules:

  1. Begin with Player A and roll two dice: dice d1 and dice
  2. If the sum of the two dice is odd, then accumulate it as the score of Player A. If even, then the score is
  3. Then roll d1 and d2 for Player
  4. If the sum of the two dice is odd, then accumulate it as the score of Player B. If even, then the score is
  5. Then roll d1 and d2 for Player
  6. If the sum of the two dice is odd, then accumulate it as the score of Player C. If even, then the score is
  7. Repeat steps 1 to 6 for n rounds, where n is a positive integer provided as input by the

 

Things to keep in mind:

 

  1. You have to implement three classes, namely Player class, Dice class, and Game class, and a driver program test class that contains the main
  2. Members of Player class are:
    1. Instance variables: id, name, and
    2. Parameterized constructor with arguments as id and
  • Method: void updateScore() with argument d1 and d2. This method sums the score for the player.
  1. Method: String toString() with no argument. This method prints out the player’s name and score value in each
  1. Member of Dice class is:
    1. Method: int roll() with no argument. This method rolls the dice and returns a random number between 1 and 6
  2. Members of Game class are:
    1. Instance variables: playerA, playerB, playerC, d1, and
    2. Default constructor which initializes the id and name of each player as well as creates new objects for dice, i.e. d1 and
  • Method: Player winner() with arguments Dice1 and Dice2. This method sums the score for the player.
  1. Method: void play() with no argument. This method contains the loop in which the dice is rolled and score is recorded for each
  1. Function in the driver program is:

Method: int main(). It is the main method in which an object of class Game is created and the method play() is invoked.

Related Questions

. The fundamental operations of create, read, update, and delete (CRUD) in either Python or Java

CS 340 Milestone One Guidelines and Rubric  Overview: For this assignment, you will implement the fundamental operations of create, read, update,

. Develop a program to emulate a purchase transaction at a retail store. This  program will have two classes, a LineItem class and a Transaction class

Retail Transaction Programming Project  Project Requirements:  Develop a program to emulate a purchase transaction at a retail store. This

. The following program contains five errors. Identify the errors and fix them

7COM1028   Secure Systems Programming   Referral Coursework: Secure

. Accepts the following from a user: Item Name Item Quantity Item Price Allows the user to create a file to store the sales receipt contents

Create a GUI program that:Accepts the following from a user:Item NameItem QuantityItem PriceAllows the user to create a file to store the sales receip

. The final project will encompass developing a web service using a software stack and implementing an industry-standard interface. Regardless of whether you choose to pursue application development goals as a pure developer or as a software engineer

CS 340 Final Project Guidelines and Rubric  Overview The final project will encompass developing a web service using a software stack and impleme

Get Free Quote!

431 Experts Online