Link to home
Start Free TrialLog in
Avatar of pacman32689
pacman32689

asked on

Formatting my output for my appointment book

Alright, I am so close to getting this son of a gun finished I can taste it. Now that my classes appear in somewhat working order, I am looking to output in the following format.

Daily Schedule for week of x xth, xxxx

Sunday
             9:00 am Wake up and go to class
             2:30 pm Go to dentist
Monday
             10:30 am English Class
              6:30 Date with Emily
ect...

I figure the best way to do this is to overload the << operator in Daily Appointment Scheduler

I attempted something roughly along these lines
cout << object

for( int i = 0; i < 9; i++)
{
   if(calendarTime.getHours() > 0)
{
         os <<  calendarTime[i].getHours() << ":" << calendarTime[i].getMinutes() << " " <<       calendarTime[i].getTimeOfDay() << " " << calendarTime[i].getPurposeMember() << endl;
}

return os;

Does that look alright?

Below is my current code. Thanks for all the help!



//Time.h
 
#include <iostream>
#ifndef TIME_H
#define TIME_H
 
using namespace std;
 
class Time
{
        private:
                        int minutes;
                        int hours;
                        bool timeOfDay;
        public:
                Time();
                Time(int,int,bool);
                int getMinutes() const;
                int getHours() const;
                void setMinutes(int);
                void setHours(int);
                void setTimeOfDay(bool);
                bool getTimeOfDay() const;
                friend ostream &operator << (ostream &, const Time &);
};
#endif
 
 
//Time.cpp
 
#include "Time.h"
#include <iostream>
using namespace std;
 
Time::Time()
{
        hours = 0;
        minutes = 0;
        timeOfDay = false;
}
Time::Time(int hours1, int minutes, bool timeOfDay1)
{
        hours = hours1;
        minutes = minutes;
        timeOfDay = timeOfDay1;
}
int Time::getMinutes() const
{
        return minutes;
}
 
void Time::setMinutes(int newMinutes)
{
        minutes = newMinutes;
}
 
int Time::getHours() const
{
        return hours;
}
void Time::setHours(int newHours)
{
        hours = newHours;
}
bool Time::getTimeOfDay() const
{
        if(timeOfDay == true)
        {
                return true;
        }
        else
                return false;
 
}
void Time::setTimeOfDay(bool newTimeOfDay)
{
        timeOfDay = newTimeOfDay;
} 
 
ostream & operator << (ostream & os, const Time & d)
{ 
        os << "Time: " << d.getHours() << ":" << d.getMinutes() << " ";
        if(d.getTimeOfDay() == true)
        {
                os << "pm" << endl;
        }
        else
                os << "am" << endl;
        return os;
}
 
//Date.h
 
#ifndef DATE_H
#define DATE_H
#include <iostream>
using namespace std;
 
class Date
{
        private:
                        int month;
                        int day;
                        int year;
        public:
                        Date();
                        Date(int,int,int);
                        int getMonth() const;
                        void setMonth(int);
                        int getDay() const;
                        void setDay(int);
                        int getYear() const;
                        void setYear(int);
                        friend ostream &operator << (ostream &, const Date &);
                        Date(const Date& d);
};
#endif
 
 
#include "Date.h"
#include <iostream>
 
Date::Date()
{
        day = 0;
        month = 0;
        year = 0;
}
Date::Date(int day1, int month1, int year1)
{
        day = day1;
        month = month1;
        year = year1;
}
int Date::getMonth() const
{
        return month;
}
 
void Date::setMonth(int newMonth)
{
        month = newMonth;
}
 
int Date::getDay() const
{
        return day;
}
 
void Date::setDay(int newDay)
{
        day = newDay;
}
 
int Date::getYear() const
{
        return year;
}
 
void Date::setYear(int newYear)
{
        year = newYear;
}
 
ostream & operator << (ostream & os, const Date& d)
{
        os << "Date: " << d.getDay() << "/" << d.getMonth()<< "/" << d.getYear() <<  endl;
        return os;
}
Date::Date(const Date& d)
{  
        day = d.getDay();
        month = d.getMonth();
        year = d.getYear();
}
 
//DailyAppointmentScheduler.h
 
#include <iostream>
#include "Date.h"
#include "Time.h"
#ifndef DAILYAPPOINTMENTSCHEDULER_H
#define DAILYAPPOINTMENTSCHEDULER_H
 
class DailyAppointmentScheduler
{
        private:
                        static char* person;
                        char* purpose[10];
                        Date calendarDate;
                        Time calendarTime[10];
        public:
                        DailyAppointmentScheduler();
                        DailyAppointmentScheduler(Date,Time);
                        const char* getPerson() const;
                        void setPerson(char*);
                        const char* getPurpose() const;
                        void setPurpose(const char*,int);
                        const char* getPurposeMember(int i) const;
                        ~DailyAppointmentScheduler();
                        DailyAppointmentScheduler &operator=(const DailyAppointmentScheduler&);
                        friend ostream &operator<<(ostream &, const DailyAppointmentScheduler);
};
#endif
 
//DailyAppointmentCalender.cpp
 
#include "DailyAppointmentScheduler.h"
#include "Time.h"
#include "Date.h"
 
#include <iostream>
 
using namespace std;
 
char * DailyAppointmentScheduler::person = NULL;
 
DailyAppointmentScheduler::DailyAppointmentScheduler()
{
}
DailyAppointmentScheduler::DailyAppointmentScheduler(Date,Time)
{
}
const char* DailyAppointmentScheduler::getPerson() const
{
        return person;
}
void DailyAppointmentScheduler::setPerson(char* newPerson)
{
        delete [] person;
        person = new char[strlen(newPerson+1)];
        strcpy(person,newPerson);
}
const char* DailyAppointmentScheduler::getPurpose() const
{
        return *purpose;
}
void DailyAppointmentScheduler::setPurpose(const char* newPurpose, int spot)
{
        purpose[spot] = new char[strlen(newPurpose)+1];
        strcpy(purpose[spot],newPurpose);
}
DailyAppointmentScheduler::~DailyAppointmentScheduler()
{
        delete person;
}
const char* DailyAppointmentScheduler::getPurposeMember(int a) const
{
        return purpose[a];
}
DailyAppointmentScheduler& DailyAppointmentScheduler::operator=(const DailyAppointmentScheduler& p)
{
        delete person;
        person = new char[strlen(p.getPerson()+1)];
        strcpy(person,p.getPerson());
}
 
ostream& operator << (ostream& os, const DailyAppointmentScheduler& s)
{
  // code I suggested above goes here
}

Open in new window

Avatar of evilrix
evilrix
Flag of United Kingdom of Great Britain and Northern Ireland image

Food for thought (untested code!)...
ostream& operator << (ostream& os, const DailyAppointmentScheduler& s)
{
	// <--- RX: You need to print day of week ehere as text, no?
	for( int i = 0; i < 9; i++)
	{
		if(calendarTime.getHours() > 0)
		{
			os
				<< calendarTime[i].getHours() << ":" << calendarTime[i].getMinutes() << " " // <--- RX: either this
				<< calendarTime[i].getTimeOfDay() << " " // <--- RX: or this seem redundent
				<< calendarTime[i].getPurposeMember()
				<< endl;
		}
	}
 
	return os;
}

Open in new window

ASKER CERTIFIED SOLUTION
Avatar of Infinity08
Infinity08
Flag of Belgium image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of pacman32689
pacman32689

ASKER

Yea see evilrx, I still get calendarTime was not declared in scope, which is really really weird.
>> Yea see evilrx, I still get calendarTime was not declared in scope, which is really really weird.

I don't know in which of your questions I said this, but you need to use s.calendarTime inside the operator<<
And do you understand how the example code that I posted works ?
I also went and added an & to my friend declaration in Das.h
Sry Infinity just woke up @_@. I understand completely what you put, I tried that at first. But for some reason, Time if giving me back a memory address when I try  to use its overloaded operator.
No dice on s. Is it because in my constructors I have blanks?
>> But for some reason, Time if giving me back a memory address when I try  to use its overloaded operator.

Can you show the complete code you're using now ?
Well I will be.... Just retested it and it works now.
I'm going to run it a few times to make sure.
Now to make an output of 3:8 change to 3:08  do I need to set precision to (2) or do I just have an if statement that concatenates a 0 should getMinutes() be < 10?
I tested by outputting su[0]. Now to do so in my overloaded statement it would just be s.calendarTime[i] correct?
ostream& operator << (ostream& os, const DailyAppointmentScheduler& s)
{  
        for( int i = 0; i < 9; i++)
        {
                if(s.calendarTime.getHours() > 0)
                {
                        os
                                << s.calenderTime[i]
                                << s.getPurposeMember(i)
                                << endl;
                }
        }

        return os;
}
 
DailyAppointmentScheduler.cpp: In function 'std::ostream& operator<<(std::ostream&, const DailyAppointmentScheduler&)':
DailyAppointmentScheduler.cpp:64: error: request for member 'getHours' in 's->DailyAppointmentScheduler::calendarTime', which is of non-class type 'const Time [10]'
DailyAppointmentScheduler.cpp:67: error: 'const class DailyAppointmentScheduler' has no member named 'calenderTime'

Can you post all the code please pacman?
>>                                 << s.getPurposeMember(i)

Note that you can just use purpose[i] since the operator<< is a friend of the DailyAppointmentScheduler class. Similarly for the other members of the DailyAppointmentScheduler class.


>> DailyAppointmentScheduler.cpp:64: error: request for member 'getHours' in 's->DailyAppointmentScheduler::calendarTime', which is of non-class type 'const Time [10]'

That should be s.calendarTime[i].getHours() since calendarTime is an array.

BUT : the formatting of a time should really be in the operator<< for the Time class
>> change to 3:08  do I need to set precision to (2)

Yes, you can use something like :

        os << setw(2) << setfill('0') << value;
My pleasure. I completely understand what your saying by your initial code Infinity, I tried that a couple of times last night, that is why I am so confused as to why it won't work. The overloaded time works in my driver, but not in my DailyAppointmentScheduler. I included Time.h, so it's really weird.



//Time.h
 
#include <iostream>
#ifndef TIME_H
#define TIME_H
 
using namespace std;
 
class Time
{
        private:
                        int minutes;
                        int hours;
                        bool timeOfDay;
        public:
                Time();
                Time(int,int,bool);
                int getMinutes() const;
                int getHours() const;
                void setMinutes(int);
                void setHours(int);
                void setTimeOfDay(bool);
                bool getTimeOfDay() const;
                friend ostream &operator << (ostream &, const Time &);
};
#endif
 
//Time.cpp
 
#include "Time.h"
#include <iostream>
using namespace std;
 
Time::Time()
{
        hours = 0;
        minutes = 0;
        timeOfDay = false;
}
Time::Time(int hours1, int minutes, bool timeOfDay1)
{
        hours = hours1;
        minutes = minutes;
        timeOfDay = timeOfDay1;
}
int Time::getMinutes() const
{
        return minutes;
}
 
void Time::setMinutes(int newMinutes)
{
        minutes = newMinutes;
}
 
int Time::getHours() const
{
        return hours;
}
void Time::setHours(int newHours)
{
        hours = newHours;
}
bool Time::getTimeOfDay() const
{
        if(timeOfDay == true)
        {
                return true;
        }
        else
                return false;
 
}
void Time::setTimeOfDay(bool newTimeOfDay)
{
       timeOfDay = newTimeOfDay;
} 
 
ostream & operator << (ostream & os, const Time & d)
{ 
        os << "Time: " << d.getHours() << ":" << d.getMinutes() << " ";
        if(d.getTimeOfDay() == true)
        {
                os << "pm" << endl;
        }
        else
                os << "am" << endl;
        return os;
}
 
//Date.h
 
#ifndef DATE_H
#define DATE_H
#include <iostream>
using namespace std;
 
class Date
{
        private:
                        int month;
                        int day;
                        int year;
        public:
                        Date();
                        Date(int,int,int);
                        int getMonth() const;
                        void setMonth(int);
                        int getDay() const;
                        void setDay(int);
                        int getYear() const;
                        void setYear(int);
                        friend ostream &operator << (ostream &, const Date &);
                        Date(const Date& d);
};
#endif
 
 
//Date.cpp
 
#include "Date.h"
#include <iostream>
 
Date::Date()
{
        day = 0;
        month = 0;
        year = 0;
}
Date::Date(int day1, int month1, int year1)
{
        day = day1;
        month = month1;
        year = year1;
}
int Date::getMonth() const
{
        return month;
}
 
void Date::setMonth(int newMonth)
{
        month = newMonth;
}
 
int Date::getDay() const
{
        return day;
}
 
void Date::setDay(int newDay)
{
        day = newDay;
}
 
int Date::getYear() const
{
        return year;
}
 
void Date::setYear(int newYear)
{
        year = newYear;
}
 
ostream & operator << (ostream & os, const Date& d)
{
        os << "Date: " << d.getDay() << "/" << d.getMonth()<< "/" << d.getYear() <<  endl;
        return os;
}
Date::Date(const Date& d)
{  
        day = d.getDay();
        month = d.getMonth();
        year = d.getYear();
}
 
//DAS.h
 
#include <iostream>
#include "Date.h"
#include "Time.h"
#ifndef DAILYAPPOINTMENTSCHEDULER_H
#define DAILYAPPOINTMENTSCHEDULER_H
 
class DailyAppointmentScheduler
{
        private:
                        static char* person;
                        char* purpose[10];
                        Date calendarDate;
                        Time calendarTime[10];
        public:
                        DailyAppointmentScheduler();
                        DailyAppointmentScheduler(Date,Time);
                        const char* getPerson() const;
                        void setPerson(char*);
                        const char* getPurpose() const;
                        void setPurpose(const char*,int);
                        const char* getPurposeMember(int i) const;
                        ~DailyAppointmentScheduler();
                        DailyAppointmentScheduler &operator=(const DailyAppointmentScheduler&);
                        friend ostream &operator<<(ostream &, const DailyAppointmentScheduler&);
};
#endif
 
 
//DAS.cpp
 
#include "DailyAppointmentScheduler.h"
#include "Time.h"
#include "Date.h"
 
#include <iostream>
 
using namespace std;
 
char * DailyAppointmentScheduler::person = NULL;
 
DailyAppointmentScheduler::DailyAppointmentScheduler()
{
}
DailyAppointmentScheduler::DailyAppointmentScheduler(Date,Time)
{
}
const char* DailyAppointmentScheduler::getPerson() const
{
        return person;
}
void DailyAppointmentScheduler::setPerson(char* newPerson)
{
        delete [] person;
        person = new char[strlen(newPerson+1)];
        strcpy(person,newPerson);
}
const char* DailyAppointmentScheduler::getPurpose() const
{
        return *purpose;
}
void DailyAppointmentScheduler::setPurpose(const char* newPurpose, int spot)
{
        purpose[spot] = new char[strlen(newPurpose)+1];
        strcpy(purpose[spot],newPurpose);
}
DailyAppointmentScheduler::~DailyAppointmentScheduler()
{
        delete person;
}
const char* DailyAppointmentScheduler::getPurposeMember(int a) const
{
        return purpose[a];
}
DailyAppointmentScheduler& DailyAppointmentScheduler::operator=(const DailyAppointmentScheduler& p)
{
       delete person;
        person = new char[strlen(p.getPerson()+1)];
        strcpy(person,p.getPerson());
}
 
ostream& operator << (ostream& os, const DailyAppointmentScheduler& s)
{  
        for( int i = 0; i < 9; i++)
        {
                if(s.calendarTime.getHours() > 0)
                {
                        os
                                << s.calenderTime[i]
                                << s.getPurposeMember(i)
                                << endl;
                }
        }
 
        return os;
}
 
 
 
 

Open in new window

Once again you beat me to my post Infin. :)
ostream& operator << (ostream& os, const DailyAppointmentScheduler& s)
{  
        for( int i = 0; i < 9; i++)
        {
                cout << s.calendarDate;
                if(s.calendarTime[i].getHours() > 0)
                {
                        os
                                << s.calendarTime[i]
                                << s.purpose[i]
                                << endl;
                }
        }

        return os;
}

I get this as output after doing cout << Sunday

Date: 0/0/0
Date: 0/0/0
Date: 0/0/0
Date: 0/0/0
Date: 0/0/0
Date: 0/0/0
Date: 0/0/0
Date: 0/0/0
Date: 0/0/0

>>         os << setw(2) << setfill('0') << value;

btw, as I said, do that in the operator<<'s for the Time and Date classes, not in the one for the DailyAppointmentScheduler class.
>> I get this as output after doing cout << Sunday

That means all the dates are set to all zero's. Have they been initialized ?

btw, you have this inside the operator<< :

                cout << s.calendarDate;

which should of course be :

                os << s.calendarDate;


Oh, and you probably want to put that line outside of the for loop (before it), so it doesn't get printed 9 times
I know why I got 9 returns. But it still isn't pulling the right values. I'll look at it agian.
>> But it still isn't pulling the right values.

You have no member function in DailyAppointmentScheduler& that allows you to set the date or the times.
Can you show your test code (the code in your main I assume) ?
Yea. I didn't mean to sound rude on my last post, you beat me to my post again. :)
#include <iostream>
#include "Date.h"
#include "Time.h"
#include "DailyAppointmentScheduler.h"
 
using namespace std;
 
int main ()
{
        char * person = new char[10];
        strcpy(person,"Paul");
        Date march2(3,2,2008);
        Date march3(3,3,2008);
        Date march4(3,4,2008);
        Date march5(3,5,2008);
        Date march6(3,6,2008);
        Date march7(3,7,2008);
        Date march8(3,8,2008);
        Time su[10];
        Time m[10];
        Time tu[10];
        Time w[10];
        Time th[10];
        Time f[10];
        Time sa[10];
        DailyAppointmentScheduler Sunday(march2,su[10]);
        DailyAppointmentScheduler Monday(march3,m[10]);
        DailyAppointmentScheduler Tuesday(march4,tu[10]);
        DailyAppointmentScheduler Wednesday(march5,w[10]);
        DailyAppointmentScheduler Thursday(march6,th[10]);
        DailyAppointmentScheduler Friday(march7,f[10]);
        DailyAppointmentScheduler Saturday(march8,sa[10]);
        Sunday.setPurpose("Go to jail.",0);
        su[0].setMinutes(30);
        su[0].setHours(12);
        su[0].setTimeOfDay(true);
        Sunday.setPurpose("Get out of jail.",1);
        su[1].setMinutes(45);
        su[1].setHours(6);
        su[1].setTimeOfDay(true);
        Monday.setPurpose("Brush Teeth", 9);
        m[9].setMinutes(30);
        m[9].setHours(7);
        m[9].setTimeOfDay(false);
        Monday.setPurpose("Go to sleep",3);
        m[3].setMinutes(45);
        m[3].setHours(8);
        m[3].setTimeOfDay(true);
        Tuesday.setPurpose("Go to class.",4);
        tu[4].setMinutes(50);
        tu[4].setHours(2);
        tu[4].setTimeOfDay(true);
        Wednesday.setPurpose("Read book.", 6);
        w[6].setMinutes(27);
        w[6].setHours(5);
       w[6].setTimeOfDay(true);
        Thursday.setPurpose("Take test.", 7);
        th[7].setMinutes(22);
        th[7].setHours(9);
        th[7].setTimeOfDay(false);
        Friday.setPurpose("Go to the club.",0);
        f[0].setMinutes(0);
        f[0].setHours(7);
        f[0].setTimeOfDay(true);
        Saturday.setPurpose("Try to start program early.",0);
        sa[0].setMinutes(10); 
        sa[0].setHours(2);
        sa[0].setTimeOfDay(true);
        cout << "Daily Appointment Scheduler for week of " << march2.getMonth() << "/" << march2.getDay() << "/" << march2.getYear() << endl;
        cout << Sunday;
        delete [] person;
}

Open in new window

>>         DailyAppointmentScheduler Sunday(march2,su[10]);

That constructor is not implemented ;) You have this :

DailyAppointmentScheduler::DailyAppointmentScheduler(Date,Time)
{
}

Btw, there's a little problem too : you're passing element 10 of an array of size 10. That's out-of-bounds (an array of size 10 has elements at indexes 0 to 9).

I would suggest to add a method addAppointment to the DailyAppointmentScheduler class that adds an appointment to the day. It would take a Time and a purpose as parameters.
like this?

DailyAppointmentScheduler::addAppointment(Time calendarTime, char* newPurpose, int place)
{
        purpose[place] = new char[strlen(newPurpose)+1];
        strcpy(purpose[place],newPurpose);
         
}

I am unsure as to how to incorporate calendarTime. I would need to incorporate hours minutes and am/pm, but if I am passing an object in the array of times, how could I set all three just through the arguments of the function?
Could I forgo this method if I were to make copy constructors for both date and time and just place them in the constructor above?
ie

DailyAppointmentScheduler::DailyAppointmentScheduler(Date date1,Time time1)
{
        calendarTime = time1;
        calendarDate = date1;
}

Just do :

void DailyAppointmentScheduler::addAppointment(Time time, char* newPurpose, int place)
{
        purpose[place] = new char[strlen(newPurpose)+1];
        strcpy(purpose[place],newPurpose);
        calendarTime[place] = time;
}

I made 3 changes :

1) made the method return void (you can make it return a bool or int to indicate success or failure if you want)
2) renamed the Time argument to avoid confusion
3) added the assignment of the time
If you only provide a constructor that allows you to set the appointments, then you will never be able to change, add or remove appointments once the object is created.

That's not a good idea. I would let the constructor set the date only. So you'd call it like this :

        Date d(4, 3, 2008);
        DailyAppointmentScheduler sunday(d);

and then call addAppointment whenever needed :

        Time t(17, 45);
        sunday.addAppointment(t, "sales meeting");
Your patience with me knows no bounds. :) I have to head to physics, but I think I should be able to handle it from this point, thank you.
Good job I8!

Pacman, sorry for not being much help today but I've been tied up in meetings :(
Anyway, I'm sure I'll catch you on another thread but I see I8's done a grand job of assisting you on this one :)

Cheers.

-Rx.
Alright, I have implemented all of your suggestions. I can't thank you enough for all the help you have given me. However, for some reason my minutes aren't getting pass right along with my am or pm.

Daily Appointment Scheduler for week of 2/3/2008

Date: 3/2/2008

Time: 12:134513256 pm
Go to jail.
Time: 6:-1209716297 pm
Get out of jail.

Date: 3/3/2008

Time: 9:-1208989824 pm
Go to sleep

Date: 3/4/2008

Time: 7:-1077817768 am
Go to class.

Date: 3/5/2008

Time: 10:-1209499520 pm
Read book.

Date: 3/6/2008

Time: 7:-1209794804 pm
Take test.

Date: 3/7/2008

Time: 3:-1209192460 pm
Go to the club.

Date: 3/8/2008

Time: 2:935756 am
Try to start program early.


Should I post my current code again. If I could give you 1000 pts I8 I would at this point. It is probably something dumb, so I will keep looking!
// main.cpp
include <iostream>
#include "Date.h"
#include "Time.h"
#include "DailyAppointmentScheduler.h"

using namespace std;

int main ()
{
        char * person = new char[10];
        strcpy(person,"Paul");
        Date march2(3,2,2008);
        Date march3(3,3,2008);
        Date march4(3,4,2008);
        Date march5(3,5,2008);
        Date march6(3,6,2008);
        Date march7(3,7,2008);
        Date march8(3,8,2008);
        Time t0(12,45,true);
        Time t1(6,30,true);
        Time t2(6,30,false);
        Time t3(9,30,true);
        Time t4(7,30,false);
        Time t5(10,44,true);
        Time t6(7,44,true);
        Time t7(3,12,true);
        Time t8(2,45,false);
        DailyAppointmentScheduler Sunday(march2);
        DailyAppointmentScheduler Monday(march3);
        DailyAppointmentScheduler Tuesday(march4);
        DailyAppointmentScheduler Wednesday(march5);
        DailyAppointmentScheduler Thursday(march6);
        DailyAppointmentScheduler Friday(march7);
        DailyAppointmentScheduler Saturday(march8);
        Sunday.addAppointment(t0,"Go to jail.",0);
        Sunday.addAppointment(t1,"Get out of jail.",1);
        Monday.addAppointment(t2,"Brush Teeth",9);
        Monday.addAppointment(t3,"Go to sleep",3);
        Tuesday.addAppointment(t4,"Go to class.",4);
        Wednesday.addAppointment(t5,"Read book.", 6);
        Thursday.addAppointment(t6,"Take test.", 7);
        Friday.addAppointment(t7,"Go to the club.",0);
        Saturday.addAppointment(t8,"Try to start program early.",0);
        cout << "Daily Appointment Scheduler for week of " << march2.getMonth() << "/" << march2.getDay() << "$
        cout << endl;
        cout << Sunday;
        cout << Monday;
        cout << Tuesday;
        cout << Wednesday;
        cout << Thursday;
        cout << Friday;
        cout << Saturday;
        delete [] person;
}

//time.h

#include <iostream>
#ifndef TIME_H
#define TIME_H

using namespace std;

class Time
{
        private:
                        int minutes;
                        int hours;
                        bool timeOfDay;
        public:
                Time();
                Time(int,int,bool);
                int getMinutes() const;
                int getHours() const;
                void setMinutes(int);
                void setHours(int);
                void setTimeOfDay(bool);
                bool getTimeOfDay() const;
                friend ostream &operator << (ostream &, const Time &);
};
#endif

//time.cpp

#include "Time.h"
#include <iostream>
#include <iomanip>
using namespace std;

Time::Time()
{
        hours = 0;
        minutes = 0;
        timeOfDay = false;
}
Time::Time(int hours1, int minutes, bool timeOfDay1)
{
        hours = hours1;
        minutes = minutes;
        timeOfDay = timeOfDay1;
}
int Time::getMinutes() const
{
        return minutes;
}

void Time::setMinutes(int newMinutes)
{
        minutes = newMinutes;
}

int Time::getHours() const
{
        return hours;
}
void Time::setHours(int newHours)
{
        hours = newHours;
}
bool Time::getTimeOfDay() const
{
        if(timeOfDay == true)
        {
                return true;
        }
        else
                return false;

}
void Time::setTimeOfDay(bool newTimeOfDay)
{
        timeOfDay = newTimeOfDay;
}
 
ostream & operator << (ostream & os, const Time & d)
{  
        os << "Time: " << d.getHours() << ":" << setw(2) << setfill('0') << d.getMinutes() << " ";
        if(d.getTimeOfDay() == true)
        {
                os << "pm" << endl;
        }
        else
                os << "am" << endl;
        return os;
}
You re-introduced an error we fixed earlier :

Time::Time(int hours1, int minutes, bool timeOfDay1)
{
        hours = hours1;
        minutes = minutes;
        timeOfDay = timeOfDay1;
}

Note that the second parameter is called minutes, which is the same as the class member. You want to call the parameter minutes1 instead.
D'oh that was dumb. However, I am perplexed as to why my am/pms are still messed up. It should go

pm
pm
am
pm
am
pm
pm
pm
am

and I am getting

pm
pm
pm
am
pm
pm
pm
am

Weird huh?
You have to take into account the position you added the appointments in. For example :

        Monday.addAppointment(t2,"Brush Teeth",9);
        Monday.addAppointment(t3,"Go to sleep",3);

You add t2 first, and then t3, but you actually place t3 before t2 in the appointments array.
Ah, you are correct. I was just trying to check various spots in my array. Thank you so much for your help, your awesome. I promise to get better at this :)

(Running on 0 sleep atm)
You deserve a medal.
>> I promise to get better at this :)

You're doing fine :) We've all had to go through this learning process. Just remember to practice a lot, and you'll get an expert in no time ;)