// CSE 303, Spring 2009, Marty Stepp // Homework 7: Birthday/Date // Client program that uses Date class (skeleton) // You should edit this file to finish the daysTillBday and daysOld methods. #include "Date.h" using namespace std; // function declarations void readDate(Date& date, string prompt); void dateStats(const Date& date); void daysTillBday(const Date& birthdate, Date today); void daysOld(Date& birthdate, const Date& today); int main() { // prompt for user's birthdate Date birthdate(2009, 1, 1); readDate(birthdate, "your birthdate"); // prompt for today / print stats Date today(2009, 1, 1); readDate(today, "today's date"); // compute information about the user's birthdate daysTillBday(birthdate, today); daysOld(birthdate, today); return 0; } // Fills in the given Date with a year, month, and day read from the user. void readDate(Date& date, string prompt) { cout << "Please type " << prompt << " (y m d)? "; int year, month, day; cin >> year; cin >> month; cin >> day; date.setDate(year, month, day); dateStats(date); } // Prints what day of the month/year the user was born, and what day is today. void dateStats(const Date& date) { cout << "Info about " << date << ":" << endl; cout << "It is day #" << date.getDay() << " of " << date.daysInMonth() << " of the month" << endl; // uncomment these lines if you do the dayOfYear extra credit method // cout << "It is day #" << date.dayOfYear() << " of " << // date.daysInYear() << " of the year" << endl << endl; } // Prints the number of days until the user's next birthday, or Happy Birthday! void daysTillBday(const Date& birthdate, Date today) { // *** you need to finish this part *** cout << "It will be your birthday in 0 days" << endl; } // Prints how many total days old the user is. void daysOld(Date& birthdate, const Date& today) { // *** you need to finish this part *** cout << "You are 0 days old" << endl; }