Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Using c++ . An int data field named faceValue that stores the face value of the die. A default constructor (set the default value to

image text in transcribed
Using c++
. An int data field named faceValue that stores the face value of the die. A default constructor (set the default value to a random number between 1-6) A constructor with parameter that creates a die object with the specified value in the parameter The getter and setter methods for all data field . A method roll) that "rolls" the die. Hint. This means the face value changes to another random number 1-6 An output method that displays This die has face value: "+X (where x is the face value) To generate random numbers include the following libraries at top of file "include and first line in main should be Using the Die class in your main function implement a simple dice game that a user can play against the computer. The object of the game is to be the first to score 20 points after repeatedly rolling 2 dice. The program asks the user for a number between 1 and 6 and creates a user die object with that face value. It also creates a second die object, computer die, in a default way. The program repeatedly rolls both dies until one of them hits the magic 20 points. After that the program prints to the screen whether the user die or the computer die won, OR if the game was a tie. Eg. Below are some face values after several rols User die: 3 computer Die: 6 User die: 5 computer Die:6 User die: 6 computer Die:4

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

Machine Learning And Knowledge Discovery In Databases European Conference Ecml Pkdd 2015 Porto Portugal September 7 11 2015 Proceedings Part 1 Lnai 9284

Authors: Annalisa Appice ,Pedro Pereira Rodrigues ,Vitor Santos Costa ,Carlos Soares ,Joao Gama ,Alipio Jorge

1st Edition

3319235273, 978-3319235271

More Books

Students also viewed these Databases questions

Question

Question in Chemical Engineering Please give Correct Answer 1 2 8 .

Answered: 1 week ago

Question

EXPLAIN the strategic importance of technology in HRM.

Answered: 1 week ago

Question

Define induction and what are its objectives ?

Answered: 1 week ago

Question

Discuss the techniques of job analysis.

Answered: 1 week ago

Question

How do we do subnetting in IPv6?Explain with a suitable example.

Answered: 1 week ago

Question

Explain the guideline for job description.

Answered: 1 week ago

Question

What is job description ? State the uses of job description.

Answered: 1 week ago

Question

13-4 What are alternative methods for building information systems?

Answered: 1 week ago