Question: C++, I have most of the code done but need help finishing the problem. MY CODE THAT YOU CAN COPY AND PASTE int rollDice() {

C++, I have most of the code done but need help finishing the problem.

C++, I have most of the code done but need help finishingthe problem. MY CODE THAT YOU CAN COPY AND PASTE int rollDice()

MY CODE THAT YOU CAN COPY AND PASTE

int rollDice() { return rand()%6+1; }

// displays the welcome message

void welcomeGame() { cout

// simulate human's turn

int humanTurn(int turn)

{ char rolltheDice='y'; char rollAgain='y'; int turnTotal=0; int dice_value; cout > rolltheDice; dice_value = rollDice(); cout

} cout> rollAgain; if(rollAgain == 'n' || rollAgain == 'N') { break; }

} turn = 0; return turnTotal;

}

// simulate computer's turn

int computerTurn(int turn) { int compturnTotal = 0; int dice_value; cout

} turn = 1; return compturnTotal; }

void game()

{ int turn = 1; int compTotal = 0; int humanTotal = 0; welcomeGame(); while(compTotal

} if(humanTotal >=100) { cout

else { cout

}

ADJUSTMENTS NEEDED TO FOLLOW THIS FORMAT

{ return rand()%6+1; } // displays the welcome message void welcomeGame() {THANK YOU

(Problem 3, 60 points) This project's objective is to create a Jeopardy Dice game in which one player (the user) competes against the computer to reach 80 points. To start this project, download the template file jeopardyDice.cpp from Moodle Game Mechanics There are two players: the user and the computer, who alternate turns until one of them reaches 80 points or higher . . The user is always the first player and starts the game . If either player reaches 80 points or more at the end of their turn, the game ends immediately and the other player does not get another turn During one turn the player (either the user or computer) accumulates a total number of points equal to turnTotal by repeatedly rolling a single fair 6-sided . le o At the beginning of the player's turn, turnTotal starts at 0 o If they roll a 2 or 5, their turn ends and the turnTotal is equal to 0 o If they roll a 4, their turn ends and turnTotal is equal to 15 (irrespective what they collected up to that roll) o If they roll a 1, 3, or 6, turnTotal increases by the amount on the die and the player rolls again o The value on the die is selected randomly during every roll At the end of the turn, a player's total score, playerTotal (either user or computer based on the turn), is increased by turnTotal. . During a player's turn, before each roll, they are given two options o Continue rolling Hold; if the user chooses to Hold the user's turn ends, turnTotal is added to playerTotal, and the turn is passed to the computer o . If the player is the computer, they will always continue rolling until their turnTotal reaches the value 10 or higher, at which point the computer player will end its turn and play passes to the user #include #include #include #include #include using namespace std; *rollDie returns a random integer between 1 and 6, works as rolling a die. +return value, int number (1-6) int rollDie( return random ( ) % 6 + 1; // your 3 + functions go in here +game) driver function to play the game *the function does not return any value void game () // your solution goes here int main () // start the game! game ) return 0; Expected Welcome to Jeopardy Dice! It is now human's turn Got Welcome to Jeopardy Dice! It is now human's turn Do you want to roll a dice (Y/N)?: You rolled a 2 Your turn total is 0 computer: 0 human: 0 Do you want to roll a dice (Y/N)?: You rolled a 2 Your turn total is0 It is now human's turn Do you want to roll a dice (Y/N)?: You rolled a 6 Player turn total is 6 Do you want to roll again (Y/N)? It is now huma It is now computer's turn Computer rolled a 6 Computer turn total is 6 Computer rolled a 5 Computer turn total is 0 computer: 0 human: 0 Do you want to roll a dice (Y/N)?: You rolled a 5 Your turn total is 0 It is now human's turn Do you want to roll a dice (Y/N)?: You rolled a 5 Your turn total is 0 It is now human's turn It is now human's turn Do you want to roll a dice (Y/N)?: You rolled a 5 Your turn total is a

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!