Overview

In this lab, you will use a provided Date class to create a guessing game, where the user attempts to guess a pre-defined target date. You will construct a date object from the user’s input, provide the user with hints (e.g., too high, too low).

  • Please email me a code related question before class on Tues 13 Nov.

  • Due Thurs 15 Nov 2018 at midnight

  • Submission Form

Required Code

  • Use Date.h in the following Repl.it

    1. Date Class Repl.it

    2. The Date class above includes friend function declarations for boolean operators (<, >, and ==). You must provide appropriate definitions for these functions outside of the class definition (e.g., in friends.h).

  • You must create a function that prompts a user for year, month, and day, and then creates and returns a Date object.

    1. No error checking is required here.

Your program should:

  1. Construct a Date object at the beginning of main() with the target date (your choice).

  2. Contain a loop that asks the user to guess a date (use the above function).

    1. The loop should allow 12 guesses at most.

  3. Use boolean operators to compare the user’s guess with the target date.

    1. If they match, congratulate the user and exit.

    2. If greater or less than, inform the user (too high, too low), inform them how many guesses remain. If any guesses remain, ask them to guess again. Otherwise, reveal the date and a consolation message, and exit.

Notes

  • You may not modify Date.h.

Required Runs

  • For this assignment, you do not need to record output from the actual runs, or to submit a pdf.

  • Ask 3 friends or classmates to play the game. For each person, simply record the number of guesses required (or failure).

Grading

Requirement Points

Program runs, correct implementation & output

70

Code formatting and readability

30

Specifics

  • 15 points: Proper indentation (Formatting)

  • 15 points: Informative comments (Readibility)

  • 15 points: Program output should be readable, well-formatted, and correct (Output)