Create the following program or propose one of your own. The program must include at least one of each of the following.
- Decision structure
- Repetitive structure
- function
- array
- Class and it must be used
Create a class for a deck of cards. Decide what attributes and methods you will need.
HINT: Think about the characteristics of a deck of cards and what you can do with it. Also, see if there are any built-in or library functions that will help.
Write a program using the class. The program needs to provide a menu to the user with the following options:
1. Reset the deck
2. Shuffle the deck
3. Cut the deck
4. Cut to a card.
5. Cut against the computer
6. Exit
Each of these options must work.
- To clarify the menu options, reset the deck would put the deck back to default state.
- Shuffle the deck should do as described; shuffle the cards to a random order.
- Cut the deck would be flipping the deck so that the bottom half is on top.
- Cutting to a card is when you cut the deck at a random point and draw the card at that point.
- Cutting against somebody is when two people cut to a card and the one with the highest card is the winner.
- When cutting against the computer you should allow the user some input to pick their card such as entering a number in a certain range. You can select the computer's randomly.