Your instructor will assign you one of the problems below. To solve your problem, write a program that reads the necessary information to compute and output the indicated values, as efficiently as possible. Following the pattern in the lab exercise, first, design using OCD; then code your design in C++ using stepwise translation; finally, test your program thoroughly.
Project #12.1: Extend your
Genderenumeration with these operations:
Write a driver program that tests your functions.
Next(Gender value);that returns the enumerator that follows
value, wrapping around from the last valid enumerator to the first valid enumerator---returns
FEMALE, and returns
Previous(Gender value);that returns the enumerator that precedes
value, wrapping around from the first valid enumerator to the last valid enumerator---i.e., returns
UNKNOWN, and returns
Project #12.2: Build a
Monthenumeration. Using it, create a
Dateclass that stores the month, day, and year for a date. Test your class by writing a program that reads two dates, and returns the number of days between those two dates (don't forget to consider leap years).
Project #12.3: Extend the classes in
enumGenerator.cppto automatically generate the
Previous()functions described in the previous project for any enumeration.
Project #12.4: Build two enumerations:
- Suit, containing the values Clubs, Diamonds, Hearts and Spades.
- Rank, containing the values Ace, Two, Three, Four, Five, Six, Seven, Eight, Nine, Ten, Jack, Queen, King.
Use these enumerations to design and build a
PlayingCardclass. Using this class and
vector, build a
DeckOfCardsclass. Provide the following operations:
Use these classes to write a program that plays a simple card game, such as "Go Fish."
- A constructor that creates a new (in-order) deck of cards.
Shuffle()operation that arranges the
PlayingCards in a
DeckOfCardsin random order.
TopCard()operation that returns the top card in the
DeckOfCards()without removing it.
DealTopCard()operation that returns the top card in the
DeckOfCards()and removes it.
Turn the following things: