Question: I need HELP IN THIS PLEASE!! for the current weeks assignment, you will do the following: Review the files (holiday.h, calendar.h, holiday_impl.cpp and calendar_impl.cpp) Complete
I need HELP IN THIS PLEASE!!
for the current weeks assignment, you will do the following: Review the files (holiday.h, calendar.h, holiday_impl.cpp and calendar_impl.cpp)
Complete the sections outlined in red in the holiday_driver.cpp file below:
ceo_driver.cpp #include "holiday.h" #include "calendar.h"
int main(){ holiday event("Thanksgiving", "November"); //Update event using the friend function //update_holiday //Call the print function on event
//Create a variable new_calendar which is a //pointer to an instance of a calendar object
//call the set_holiday_name function on //new_calendar to set the value of the //calendar_holiday variable to Presidents Day
//Next, declare a variable old_calendar which //is a pointer to a holiday class and make //old_calendar equal to new_calendar
//Use the set_holiday_name function on //old_calendar and set the holiday name to //Labor Day
//Call the print function on new_calendar
//Call the get_object function on old_calendar //and then the print function on the result //that you get from calling the get_object //function on old_calendar
return 0; } }
calendar_impl.cpp
#include "holiday.h"
#include "calendar.h"
calendar::calendar(string choliday){
calendar_holiday = choliday;
}
void calendar::set_holiday_name
(string chname){
cout<<"Inside Calendar Class"
<
calendar_holiday = chname;
}
string calendar::get_holiday_name(){
return calendar_holiday;
}
void calendar::print(){
cout<
cout<<"Inside Calendar Class"
<
cout<
cout<<"Calendar Holiday Name = "
<
}
calendar.h
#include "holiday.h"
class calendar: public holiday{
private:
string calendar_holiday;
public:
calendar(){};
calendar(string);
void set_holiday_name(string);
string get_holiday_name();
void print();
};
holiday_driver.cpp
#include "holiday.h"
#include "calendar.h"
int main(){
holiday event("Thanksgiving", "November");
//Update event using the friend function
//update_holiday
event = update_holiday(event);
//Create a variable new_calendar which is a
//pointer to an instance of a calendar object
calendar *new_calendar = new calendar;
//call the set_holiday_name function on
//new_calendar to set the value of the
//calendar_holiday variable to Presidents Day
new_calendar->set_holiday_name("Presidents Day");
//Next, declare a variable old_calendar which
//is a pointer to a holiday class and make
//old_calendar equal to new_calendar
holiday *old_calendar;
old_calendar = new_calendar;
//Use the set_holiday_name function on
//old_calendar and set the holiday name to
//Labor Day
old_calendar->set_holiday_name("Labor Day");
//Call the print function on new_calendar
new_calendar->print();
//Call the get_object function on old_calendar
//and then the print function on the result
//that you get from calling the get_object
//function on old_caledar
old_calendar->get_object()->print();
return 0;
}
holiday_impl.cpp
#include "holiday.h"
holiday::holiday(string hname,
string hmonth){
holiday_name = hname;
holiday_month = hmonth;
}
holiday update_holiday( holiday h){
h.holiday_name = "Easter";
h.holiday_month = "April";
return h;
}
void holiday::set_holiday_name
(string hname){
holiday_name = hname;
}
void holiday::set_holiday_month
(string hmonth){
holiday_month = hmonth;
}
string holiday::get_holiday_name(){
return holiday_name;
}
string holiday::get_holiday_month(){
return holiday_month;
}
void holiday::print(){
cout<
cout<<"Holiday Name = "
<
cout<<"Holiday Month = "
<
}
holiday.h
#pragma once
#include
#include
#include
using namespace std;
class holiday{
friend holiday update_holiday(holiday);
protected:
string holiday_name;
string holiday_month;
public:
holiday(){};
holiday(string, string);
virtual void set_holiday_name(string);
void set_holiday_month(string);
string get_holiday_name();
string get_holiday_month();
holiday* get_object(){
cout<
<<""<
cout<<("Inside Holiday Class")<
cout<
<<""<
return this;
}
virtual void print();
};
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
