Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

I need help with my C++ program. I want my main() program to be interactive with user to schedule and report on appointment. Appointments can

I need help with my C++ program. I want my main() program to be interactive with user to schedule and report on appointment. Appointments can start every hour or half-hour, and that makes 48 appointment objects to represent one day. (Your interactive program should be able to handle appointments that last 2 hours - by scheduling 4 appt objects, for example.)

Also implement enumeration for the days and types of appointments.Use inheritance and derive a class from appt that is used for business appointments, (adding fields for priority, deadline, location, cost, and a pay code)

/////////////////////////// main.cpp /////////////// #include "weekly.h" #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 << "Testing the weekly class" << std::endl << std::endl; std::cout << "Several things will be scheduled, and then displayed." << std::endl << std::endl; success = w.schedule(a1); if (!success) { std::cout << "There was a problem scheduling that." << std::endl; } success = w.schedule(a2); if (!success) { std::cout << "There was a problem scheduling that." << std::endl; } success = w.schedule(a3); if (!success) { std::cout << "There was a problem scheduling that." << std::endl; } success = w.schedule(a4); if (!success) { std::cout << "There was a problem scheduling that." << std::endl; } success = w.schedule(a5); if (!success) { std::cout << "There was a problem scheduling that." << std::endl; } success = w.schedule(a6); if (!success) { std::cout << "There was a problem scheduling that." << std::endl; } a7 = w.lookup(1, 1000); std::cout << "The task for Monday at 10:00 is: " << a7->get_task() << std::endl; w.show_times(1, 1100, 1700); w.show_times(2, 800, 1800); w.show_times(3, 0, 2345); std::cout << "Removing a task from Wednesday and re-printing:" << std::endl; w.unschedule(a5); w.show_times(3, 0, 2345); std::cout << "Clearing the schedule and re-printing." << std::endl; w.clear(); w.show_times(3, 0, 2345); system("pause"); return 0; }

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

MySQL/PHP Database Applications

Authors: Jay Greenspan, Brad Bulger

1st Edition

978-0764535376

More Books

Students also viewed these Databases questions