Exercise

Exercise

Exercise P8.1. Derive a class Programmer from Employee. Supply a constructor Programmer (string name, double salary) that calls the base-class constructor.
Supply a function get_name that returns the name in the format "Hacker, Harry (Programmer)".
Exercise P8.4. Implement a base class Account and derived classes Savings and Checking. In the base class, supply member functions deposit and withdraw. Provide a function daily_interest that computes and adds the daily interest. For calculations, assume that every month has 30 days. Checking accounts yield interest of 3 percent monthly on balances over $1,000. Savings accounts yield interest of 6 percent on the entire balance. Write a driver program that makes a month’s worth of deposits and withdrawals and calculates the interest every day.
Exercise P8.7. Implement a base class Appointment and derived classes Onetime, Daily,
Weekly, and Monthly. An appointment has a description (for example, “see the dentist”)
and a date and time. Write a virtual function occurs_on(int year, int month, int day) that checks whether the appointment occurs on that date. For example, for a monthly appointment, you must check whether the day of the month matches. Then fill a vector of Appointment* with a mixture of appointments. Have the user enter a date and print out all appointments that happen on that date. ExerciseP8.8. Improve the appointment book program of Exercise P8.7. Give the user the option to add new appointments. The user must specify the type of the appointment, the description, and the date and time.
Powered by