Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

// Use the following .H file and driver function prototypes // Write all class f

ID: 655664 • Letter: #

Question

// Use the following .H file and driver function prototypes
// Write all class functions
// Write all driver functions
// Create a driver program to test all functions
// schedule header file
#ifndef SCHEDULE_H
#define SCHEDULE_H
#include "appointment.h"
#include
using std::ostream;
const int SCH_ENTRIES = 10;
class schedule {
   public:
   schedule( void); // Default Constructor

   schedule( const char * p); // title only

   schedule( const schedule &); // copy constructor

   bool addtoSchedule(const appointment &); // if full, return false
                               // otherwise place in the schedule and return true

   bool isFull(void) const; // true if no cells left, false otherwise

   void print(ostream &) const; // print all appointments

   void printForSource(long s, ostream &) const;
                                           // print only appointments that match that source

   appointment search( long s) const;
                   // will return a copy of the first appointment found that matches
                   // the source s, if no match, return an appointment with
                   // a source of -1 and a description of "Not Found";

   static void setDateFlag(int);   
   private:
   char title[40]; // title of the schedule
   int count; // number of appointments currently in the schedule
   appointment appointmentArray[SCH_ENTRIES];
   static int dateFlag;
};
#endif

           // Driver program functions

bool keyBoardEnterAppointment( schedule & ); // return true if successful
                                                   // return false if full

bool addFutureAppointment( schedule &, const appointment & e, int d);
                       // return true if successful, false if full
                       // the appointment added has the same source and
                       // desc as the appointment e, but a date of d days later

bool addRecurringAppointment( schedule &, const appointment & e, int cycle, int times);
// return true if successful, false if full
// times will indicate the number of appointments to add
// each appointment added will have the same source and
// desc as the appointment e, but a date of cycle days later
                               // than the previous appointment added to the schedule

schedule::schedule( void)
{
count = 0;
title = "";
  
  
}
schedule::schedule( const char * p)
{
// count = p;
// title = p;
strcpy(title, p);
count = 0;
cout << title << endl;
cout << count << endl;
cout << " ---- " << endl;
  
  

}
schedule::schedule( const schedule & other)

count = other.count;
title = other.title;

}
bool schedule::addtoSchedule(const appointment & tempApoint)
{
if(this->isfull() ){
return false;}
  
else{

appointmentArray[count] = tempApoint;
count++;
  
return true;}
  
  
/*
if(this->count == tempApoint.count){
return *this ;}
else{
return tempApoint;
}*/


}
bool schedule::isFull(void) const
{
if(count == SCH_ENTRIES){
return true;}
else{
return false;}


}
void schedule::print(ostream & out) const
{
//print(out);
for( int i=0; i < count; i++)
appointmentArray[i].print(out);
  
  
// out << ' ' < default: out << "Invalid format :(" ;
  
}


}
void appointment::setDescription(const char * description)
{
desc = new char[strlen(description) + 1 ];
strcpy(desc, description);


}
             

Explanation / Answer

bool addFutureAppointment( schedule & s, const appointment & e, int d)
{
// return true -successful, false - full
// appointment add has same source
// desc as appointment e, but date of day later
appointment temp;
if(isFull())
{
return false;}
esle{ //syntax error 'esle' should be else
return true;}
s. //no method should be called here using object s because this line will not be executed at all because return statement is already placed above
  
}