Question: Add a constructor initializer list to the default Appointment constructor to initialize month with Unrecorded, date with -100, and weekday with 'X'. Ex: If the

Add a constructor initializer list to the default Appointment constructor to initialize month with "Unrecorded", date with -100, and weekday with 'X'.

Ex: If the input is Jul 10 T, then the output is:

Appointment: Unrecorded, Date: -100, Weekday: X Appointment: Jul, Date: 10, Weekday: T

#include using namespace std;

class Appointment { public: Appointment(); void SetFields(string newMonth, int newDate, char newWeekday); void Print() const; private: string month; int date; char weekday; };

Appointment::Appointment() /* Your code goes here */ { }

void Appointment::SetFields(string newMonth, int newDate, char newWeekday) { month = newMonth; date = newDate; weekday = newWeekday; }

void Appointment::Print() const { cout << "Appointment: " << month << ", Date: " << date << ", Weekday: " << weekday << endl; }

int main() { string newMonth; int newDate; char newWeekday; Appointment myAppointment; myAppointment.Print(); cin >> newMonth; cin >> newDate; cin >> newWeekday; myAppointment.SetFields(newMonth, newDate, newWeekday); myAppointment.Print(); return 0; }

c++ and please make it correct

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!