Zebra0.com

MCC++ Programming Project: Holidays

C++ Programming Project: Holidays

A List of Dates

  1. Using the Date class, create a list of at least 5 dates. You may use either a vector or an array. Create a second list that has the name of the date: "Valentines Day", "My Dirthday", etc.
  2. Write a procedure to sort the two lists together.
  3. Write another procedure that will print the list of names and dates as Monday, March 25, 2018, for example. (Hint: use an array for the days and names of months.)
  4. Do not add the names of the days and months to the Date class. Typically a class definition is language neutral. If you want to print the output in another language, you would do that in the program that uses the class, not the class.

Note about sorting

Imagine you have an array of names: {"Mike,"Sam","Andy","Joe"}
And the phone numbers {"2276","1234","5598","1107"}
These are parallel arrays meaning that the first phone number belongs to the first person, etc.
If we sort just the names but not the phone numbers, the names will no longer be for the right person:
names is now{"Andy","Joe","Mike,"Sam" } but the phone numbers are still in the original order.
The sort needs to receive both arrays and whenever you swap 2 names you have to swap the phone numbers also:

  if(name[i]>name [i+1] {
    temp=name [i];
    name [i]=name [i+1];
    name[i+1]=temp;
    temp=phone [i];
    phone [i]= phone [i+1];
    phone [i+1]=temp;
  }
Alternatively, you can create a structure person that has both the name and date.

Submit one Word document with all of the following as part of this assignment:


This web site, and all pages therein, are the sole property and responsibility of Zebra0.com.
It is not endorsed, sponsored, or provided by or on behalf of Montgomery College.