Question: I need help my c++ homework. I need help with weekly.cpp and appt.cpp Here is my appt.h code: #ifndef APPT_H #define APPT_H #include #include //
I need help my c++ homework. I need help with weekly.cpp and appt.cpp
Here is my appt.h code:
#ifndef APPT_H
#define APPT_H
#include
#include
// This is the appointment class
// It should hold all information for the appointment
class appt
{
private:
public:
appt(int d = 0, int h = 0000, std::string item = "unset", bool done = false); // default constructor
~appt(); // destructor
// set the day of the appointment
void set_day(int d);
// set the time of the appointment
void set_time(int h);
// set the task of the appointment
void set_task(std::string item);
// set the status of the appointment
void set_is_done(bool done);
// return the day of the appointment
int get_day();
// return the time of the appointment
int get_time();
// return the task of the appointment
std::string get_task();
// return the status of the appointment
bool get_is_done();
// restores appointment information to default
void clear();
// print all the appointment information
void show_appt();
}; // end appt class
#endif
Here is my appt.cpp code:
#include "appt.h"
appt::appt(int d,int h,std::string item,bool done)
{
}
appt::~appt()
{
}
void appt::set_day(int d)
{
}
void appt::set_time(int h)
{
}
void appt::set_task(std::string item)
{
}
void appt::set_is_done(bool done)
{
}
int appt::get_day()
{
return 0;
}
int appt::get_time()
{
return 0;
}
std::string appt::get_task()
{
return (std::string)"";
}
bool appt::get_is_done()
{
return true;
}
void appt::clear()
{
}
void appt::show_appt()
{
}
Here is my code for weekly.h:
#ifndef WEEKLY_H #define WEEKLY_H
#include "appt.h" #include
// this is the weekly class // it should keep appointments for a week // it uses an array to keep track of every half-hour in each day // and of course keeps all of those in an array
class weekly { private:
public: weekly(); // default constructor ~weekly(); // destructor
// takes an appointment object and puts it in the schedule, returning true on success bool schedule(appt a); // returns a pointer to an appointment object at the day and time appt* lookup(int day, int hour); // removes an appointment at the given day and time in appointment a bool unschedule(appt a); // shows all the appointments on the given day between the given times void show_times(int day, int start, int end); // clears the entire schedule bool clear();
};
#endif
Here is my code for weekly.cpp:
#include "weekly.h"
// implementation of the weekly class
weekly::weekly()
{
}
weekly::~weekly()
{
}
// takes an appointment object and puts it in the schedule, returning true on success
bool weekly::schedule(appt a)
{
return true;
}
// returns a pointer to an appointment object at the day and time
appt* weekly::lookup(int day, int hour)
{
appt a;
return &a;
}
// removes an appointment at the given day and time in appointment a returns true on success
bool weekly::unschedule(appt a)
{
return true;
}
// shows all the appointments on the given day between the given times
void weekly::show_times(int day, int start, int end)
{
}
// clears the entire schedule, returning true on success
bool weekly::clear()
{
return true;
}
Here is the code for main():
// test the appointment class
#include "weekly.h" #include #include
int main() { bool success; appt a1(1, 1000, "laundry", false); appt a2(1, 1300, "homework assignment", false); appt a3(2, 900, "mow lawn", false); appt a4(2, 1500, "clean room", false); appt a5(3, 1230, "lunch with friends", false); appt a6; appt* a7; appt a8(1, 1730, "dentist", false);
weekly w;
a6.set_day(3); a6.set_time(1800); a6.set_task("tennis lesson");
std::cout
std::cout
success = w.schedule(a1); if(!success){ std::cout
a7 = w.lookup(1, 1000); std::cout get_task()
w.show_times(1, 1100, 1700); w.show_times(2, 800, 1800); w.show_times(3, 0, 2345);
std::cout
w.show_times(3, 0, 2345);
std::cout
w.show_times(3, 0, 2345);
system("pause"); return 0; }
Here is a sample output:

Testing the weekly class Several things will be scheduled, and then displayed. The task for Monday at 10:00 is: laundry These are the requested appointments: Day: Monday Time: 1300 Task: homework assignment Not Finished These are the requested appointments: Day Tuesday Time: 900 Task mow lawn Not Finished Day Tuesday Time 1500 Task clean room Not Finished These are the requested appointments: Day Wednesday Time: 1230 Task lunch with friends Not Finished Day Wednesday Time: 1800 Task tennis lesson Not Finished Removing a task from Wednesday and re-printing: These are the requested appointments: Day Wednesday Time 1800 Task: tennis lesson Not Finished Clearing the schedule and re-printing. These are the requested appointments: ~/workspace/week/ $
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
