Menu

[Solved]-1 Define Card Class Contains Three Private Variables Card Suit Face Value Third Indicate C Q37264380

1. Define a Card class which contains three PRIVATE (why?)variables for card suit, face value and the third to indicate ifthe card is drawn or not (these are states of a card object) plusoperations that can be performed on a card (these are behaviors),The operations include

      ONE method that compares twocards and returns a boolean indicating if one is bigger than theother.

      a constructor that takes threeparameters (suit and face value) to instantiate a card with thethird parameter indicating that the card has not been drawn at thetime of creation of the card.

      One overriding toStringmethod to be able to display the card (suit and face value)

      plus all necessary accessor andmutator methods for accessing private variables of a card

      You can add more methods if youneed to (such as equals method to check if two card are the same),but are not required besides those required methods above.

after the class is defined, save it in a file called card.java.Note that this class does not have the main method so youcannot run it on its own.

2. Write a client code which contains another class calledplayCards that uses the card objects created from the Card classdefined above and actually plays the game. This class contains themain method to execute the program.

3. Your program will start by displaying the greeting, playinginstrucctions and then a menu for user to choose, and it continuesdepending on what user chooses.   

4. When the program exits, it displays a message indicating itis the end of the program.

5. (Bonus) When a user exits the entire game, your program willdisplay number of games played and number of wins.

Expert Answer


Answer to 1. Define a Card class which contains three PRIVATE (why?) variables for card suit, face value and the third to indicate… . . .

OR


Leave a Reply

Your email address will not be published. Required fields are marked *