Program #3

In this assignment you will modify the Date class, write a new class called Person, and write a findOldest function and suitable main function to exercise them.

The New Date Class

Modify the Date class to use operator overloading. Modify equals, lessThan, daysBetween, and futureDate to use operator overloading by choosing appropriate operators. Also provide both an input and output operator by overloading operator<< and operator>>. Accept input dates in the form mm/dd/yyyy (mm, dd, yyyy must all be integers, but need not be two, two, and four digits, respectively). If you did not get Program #2 to work, here is a sketch of the Date class (minus comments, that I still expect you to add).  Date.h  Date.cpp

The Person Class

Here is the Person class, with its private members only. You must design the public interface, and then provide an implementation. You should also provide two global functions. One performs output, printing the person's name and birthdate. The other is operator< which compares two persons on the basis of birthdate (so the person with earlier birthdate is considered less than the person with later birthdate). You may not use any friend declarations.

class Person
{
  public:
    // Provide constructors as you see fit.

    // Provide accessors to get a full name (firstName + " " + lastName)
    // or birthDate.

    // Provide a print member function.

    // Provide a setValue member function to initialize all data members.
    // Or if you prefer, provide separate setter functions.

  private:
    string firstName;
    string lastName;
    Date birthDate;
};

The findOldest Function

Write a function that accepts a vector of Person and returns the oldest Person.

Testing Program

If everything works, you should be able to do the following in the same main routine: Create a vector<Person> object, push_back some Person objects, and then perform findOldest, printing the oldest person.

Due Date

This program is due on Tuesday, September 28.