Question: c++ this is assign.cpp file this is Coin.cpp file this is Coin.h file The Coin class should have the following member variable: + A string

c++

c++ this is assign.cpp file this is Coin.cpp file this is Coin.h

file The Coin class should have the following member variable: + A

string named sideUp. The sideUp member variable will hold either "heads" or

"tails indicating the side of the coin that is facing up. The

Coin class should have the following member functions: A default constructor that

randomly determines the side of the coin that is facing up ("heads"

or "tails") and initializes the sideUp member variable accordingly. + A void

member function named toss that simulates the tossing of the coin. When

this is assign.cpp file

the toss member function is called, it randomly determines the side of

this is Coin.cpp file

the coin that is facing up ("heads" or "tails") and sets the

this is Coin.h file

side Up member variable accordingly. A member function named getSideUp that returns

the value of the sideUp member variable. U II The game works

The Coin class should have the following member variable: + A string named sideUp. The sideUp member variable will hold either "heads" or "tails indicating the side of the coin that is facing up. The Coin class should have the following member functions: A default constructor that randomly determines the side of the coin that is facing up ("heads" or "tails") and initializes the sideUp member variable accordingly. + A void member function named toss that simulates the tossing of the coin. When the toss member function is called, it randomly determines the side of the coin that is facing up ("heads" or "tails") and sets the side Up member variable accordingly. A member function named getSideUp that returns the value of the sideUp member variable. U II The game works as follows (as you will see in the sample runs below): The player (you) and the computer both begin with a starting balance of $0.00. For each round of the game, both the player and the computer toss a quarter, a nickel, and a dime. For each type of coin, if the coin lands on heads, the amount of the coin is added to the player's balance. If the coin lands on tails, however, nothing is added to the player's balance for that coin. For example: The player gets heads for the quarter, heads for the dime, and tails for the nickel. $0.25 + $0.10 = $0.35 is added to the players balance for that round. The computer gets tails for the quarter, tails for the dime, and heads for the nickel. $0.05 is added to the computer's balance for that round. The maximum amount that can be added to a player's balance in a single round is $0.25 + $0.10 + $0.05 = $0.40 (heads for all three coins). The minimum amount that can be added to a player's balance in a single round is $0.00 (tails for all three coins). Coin.cpp UML Diagram for the Coin class: Coin -sideUp: string // Stores either "heads" or "tails" > +Coin() +toss() +getSideUp(): string If both players have the same balance at the end, they tie (note that this means both players not only have the same score, but their shared score is $1.00 or more) If one player has a balance of less than $1.00 when the game ends, the other player who has a balance of $1.00 or more wins. For example, if the player has $0.90 and the computer has $1.05, the computer with $1.05 wins (remember it's not possible for both players to have less than $1.00 when the game ends) If both players have a balance of $1.00 or more, the player with the lower score wins. For example, if the player ends the game with $1.10, and the computer ends the game with $1.30, the player with $1.10 wins. As you will see from the sample runs, there is NO user input for this game. Again, the game automatically ends when one or both players have a Your starting balance: $0.00 The computer's starting balance: $0.00 Your balance after round 1: $0.40 The computer's balance after round 1: $0.15 Your balance after round 2: $0.40 The computer's balance after round 2: $0.20 Your balance after round 3: $0.45 The computer's balance after round 3: $0.35 Your balance after round 4: $0.55 The computer's balance after round 4: $0.70 Your balance after round 5: $0.70 The computer's balance after round 5: $0.70 Your balance after round 6: $0.85 The computer's balance after round 6: $0.80 Your balance after round 7: $1,10 The computer's balance after round 7: $1.10 Your ending balance: $1.10 The computer's ending balance: $1,10 Tie! Nobody wins. Press any key_to continue. Your starting_balance: $0.00 The computer's starting balance: $0.00 Your balance after round 1: $0.15 The computer's balance after round 1: $0.09 Your balance after round 2: $0.20 The computer's balance after round 2: $0.30 Your balance after round 3: $0.50 The computer's balance after round 3: $0.30 Your balance after round 4: $0.65 The computer's balance after round 4: $0.65 Your balance after round 5: $0.95 The computer's balance after round 5: $0,75 Your balance after round 6: $1,10 The computer's balance after round 6: $1,05 Your ending balance: $1.10 The computer's ending balance: $1.05 Sorry! The computer won, Press any key to continue... Your starting_balance: $0.00 The computer's starting balance: $0.00 Your balance after round 1: $0.10 The computer's balance after round 1: $0.15 Your balance after round 2: $0.35 The computer's balance after round 2: $0.40 Your balance after round 3: $0.70 The computer's balance after round 3: $0.40 Your balance after round 4: $0.85 The computer's balance after round 4: $0.75 Your balance after round 5: $0.85 The computer's balance after round 5: $0.75 Your balance after round 6: $1.20 The computer's balance after round 6: $0.85 Your ending balance: $1.20 The computer's ending balance: $0.85 Congratulations! You won. Press any key to continue... // Application Program #include #include "coin.h" //IMPLEMENT 200 ASSIGN3.CPP //IMPLEMENT 200_ASSIGN3.CPP //IMPLEMENT 200_ASSIGN3.CPP TH // Implememtation file for the coin class #include // For rand and srand #include // For the time function #include "Coin.h" //IMPLEMENT COIN.CPP //IMPLEMENT COIN.CPP //IMPLEMENT COIN.CPP // Specification file for the coin class #ifndef COIN_H #define COIN_H #include //IMPLEMENT COIN.H //IMPLEMENT COIN.H //IMPLEMENT COIN.H #endif ming Assignment 3.pdf 1/10 folder on Canvas: Coin.h (class specification file) Coin.cpp (class implementation file) 200_assign3.cpp (application program) NOTE: Your submission for this assignment should be one.h file, two.cpp files (see above), and one .pdf file with screenshots of your ten sample runs. The following naming convention should be used for naming your class specification file: firstname_lastname_Coin.h The following naming convention should be used for naming your class implementation file: firstname_lastname_Coin.cpp The following naming convention should be used for naming your application program file: firstname_lastname_200_assign3.cpp The following naming convention should be used for naming your sample runs file: firstname_lastname_200_assign3.pdf Assignment 3.pat 2 IU Your solution should use all three files listed above. The Coin.h file (class specification file) should contain the class declaration, the declaration of the member variables, and prototypes for the constructor and the member functions. Nothing should be implemented in this file. The Coin.cpp file (class implementation file) should contain the implementation of the constructor and the member functions. The 200_assign3.cpp file (application program) should contain the game logic for the coin toss game

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!