subject
Computers and Technology, 21.02.2020 23:41 tia0625

Required Assignment: create a reference and a pointer (C++)a. Create a better dice game. Each player (user or computer) has 2 dices. And you are required to use 1 reference variable and 1 pointer variable. You need to indicate where you use these in your code. b. The winning rule is as follows: if 2 dices of a player have the same value as a pair of 6 and the other player does not have a pair of value then a pair of value will win. So, 5&5 will beat 6&4 because 5&5 is a pair. If both players have pairs, (user and computer), the higher pair will win. For example, 6&6 will beat any pair. If both players do not have pair, then higher total points will win. c. The output of the program may be like the following:Welcome to the dice ware game. You have 100 in your game purse. Enter a bet amount to play (0 means exit the program): 10You have 5 & 5 computer has is 3 & 4You won 10 dollars!Your game purse now has 110 dollarsEnter a bet amount to play (0 means exit the program): 5You have 6 & 4 computer has is 1 & 1You lost 5Your game purse now has 105 dollarsEnter a bet amount to play (0 means exit the program): 10You have 1 & 2 computer has is 3 & 4You lost 10Your game purse now has 95 dollarsEnter a bet amount Enter a bet amount to play (0 means exit the program): 0You choose to exit the program. Thank you and goodbyeUse these class files and create a main://GamePurse. h file#ifndef GamePurse_H#define GamePurse_H//GamePurse class declarationclass GamePurse { int purseAmount; // in main. cpp initialize it to 100public: GamePurse(int); void Win(int); void Loose(int);int GetAmount();};#endif//GamePurse. cpp file#include "GamePurse. h"//constructor implementationGamePurse::GamePurse( int balance){ //initializing purseAmount to 0 purseAmount=0; //if balance is positive, updating purseAmount if(balance>0){ purseAmount=balance; }}//Win method implementationvoid GamePurse::Win(int amount){ //adding amount to purseAmount if amount is positive if(amount>0){ purseAmount+=amount; }}//Loose method implementationvoid GamePurse::Loose(int amount){ //subtracting amount from purseAmount if amount is positive and has enough balance if(amount>0 && purseAmount>=amount){ purseAmount-=amount; }}//GetAmount method implementationint GamePurse::GetAmount(){ return purseAmount;}// DICEROLL. H FILE#ifndef DICEROLL_H#define DICEROLL_Hclass DiceRoll{ public: DiceRoll(int=0); void rollDice(); int getRoll() const; private: int rollValue;};#endif// DICEROLL. CPP FILE#include "DiceRoll. h"# includeusing namespace std;DiceRoll::DiceRoll(int num) : rollValue(num){}void DiceRoll::rollDice() {rollValue = 1+ rand()%6;}int DiceRoll::getRoll() const { return rollValue; }// main. cpp // (not whole program) : below is older version. The newer version needs the requirements above(took out code)#include "GamePurse. h"#include "DiceRoll. h"using namespace std;int main(){(took out code) GamePurse purse(100);DiceRoll player;DiceRoll computer;(took out code)do {cout << "Enter cin >> betMoney;cout << endl; if(betAmt>0){ //checking if there is enough balance or not if(betAmt>purse. GetAmount()){ cout<<"You don't have that much amount to bet"< }else{player. rollDice();computer. rollDice(); //displaying both cout<<"Your dice is "<< player. getRoll()<< endl; cout<<"Computer dice is "<< computer. getRoll() << endl; if(player. getRoll()>computer. getRoll()){(took out code) }else if(player. getRoll() < computer. getRoll()){ (took out code) }else{ cout<<"It's a tie!"< } cout<<"Your game purse now has" << purse. GetAmount << "dollars" < } } }while(betAmt!=0); //until betAmt is 0 cout<<"You choose to exit the program. Thank you and goodbye"< return 0;}

ansver
Answers: 3

Another question on Computers and Technology

question
Computers and Technology, 23.06.2019 18:30
Report all segments of identity by descent longer than 20 polymorphisms between pairs of individuals in the following cohort of 15 individuals across 49 polymorphisms: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 numeric input 2 points possible (graded) you have 2 attempts to complete the assignment below. for example if the sequence is "bcd", which occurs in "abcdef" , the starting point would be 2 (b), and the finishing point would be 4(d). individuals 7,10 between positions
Answers: 1
question
Computers and Technology, 24.06.2019 06:00
Hey i really need some solving this problem: 1. encrypt this binary string into cipher text: 110000. include in your answer the formula the decoder would use to decrypt your cipher text in the format (coded answer) x n mod (m) = y & 2. decrypt this cipher text into a binary string: 106 you.
Answers: 2
question
Computers and Technology, 24.06.2019 16:50
7.23 main lab 7 - online shopping cart background this main lab extends the earlier prep lab "online shopping cart part 1". (you should save this as a separate project from the earlier prep lab). you will create an on-line shopping cart like you might use for your on-line purchases. the goal is to become comfortable with setting up classes and using objects. requirements this lab can be done individually or as pair programming. expanded itemtopurchase class (15 points) extend the itemtopurchase class as follows. we will not do unit testing in this lab so we will not be giving you the names of the member functions. create good ones on your own. create a parameterized constructor to assign item name, item description, item price, and item quantity (default values of "none" for name and description, and 0 for price and quantity). additional public member functions set an item description get an item description print the cost of an item - outputs the item name followed by the quantity, price, and subtotal (see example) print the description of an item - outputs the item name and description (see example) additional private data members a string for the description of the item. example output of the function which prints the cost of an item: bottled water 10 @ $1.50 = $15.00 example output of the function which prints the item description:
Answers: 1
question
Computers and Technology, 24.06.2019 17:30
What is the next step if your volume does not work on computer
Answers: 2
You know the right answer?
Required Assignment: create a reference and a pointer (C++)a. Create a better dice game. Each player...
Questions
question
Mathematics, 13.01.2021 18:30
question
Mathematics, 13.01.2021 18:30
question
Mathematics, 13.01.2021 18:30
question
Mathematics, 13.01.2021 18:30
question
Mathematics, 13.01.2021 18:30
Questions on the website: 13722363