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

Design a class named TimeOff. The purpose of the class is to track an employee s

ID: 3660089 • Letter: D

Question

Design a class named TimeOff. The purpose of the class is to track an employee s sick leave, vacation, and unpaid time off. It should have, as members, the following instances of the NumDays class described in Programming Challenge 4: maxSickDays A NumDays object that records the maximum number of days of sick leave the employee may take. sickTaken A NumDays object that records the number of days of sick leave the employee has already taken. maxVacation A NumDays object that records the maximum number of days of paid vacation the employee may take. vacTaken A NumDays object that records the number of days of paid vacation the employee has already taken. maxUnpaid A NumDays object that records the maximum number of days of unpaid vacation the employee may take. unpaidTaken A NumDays object that records the number of days of unpaid leave the employee has taken. Additionally, the class should have members for holding the employee s name and identi cation number. It should have an appropriate constructor and member functions for storing and retrieving data in any of the member objects. Input Validation: Company policy states that an employee may not accumulate more than 240 hours of paid vacation. The class should not allow the maxVacation object to store a value greater than this amount.

Explanation / Answer

ch14_pc1_Numsday.h // Author: Thomas Myint // cs116, Online // Date: 03/07/05 // Description: // This Program deals and demostrate the use of class and object. //It has functions that set, get hours and days. Some other functions // add and substract hours and days. #ifndef NUMDAYS_H #define NUMDAYS_H class NumDays { private: float hours; float days; convert() {days = hours/8;} public: NumDays(float Hr=0) {hours = Hr ; convert();} setHours(float H) {hours = H; convert();} setDays(float D) {days = D; hours = D * 8.0;} float getHours() { return hours;} float getDays() {return days;} clear() { hours= days= 0;} addHours(float AHour) { hours += AHour; convert();} subHours(float SHour) { hours -= SHour; convert();} addDays(float ADay) { days += ADay; hours = days * 8.0;} subDays(float SDay) {days -= SDay; hours = days * 8.0;} }; #endif ch14_pc2: // Author: Chris Zutler // cs116, Online // Date: 2006.03.02 // Description: ch14_pc2 /* Note: This assignment assumes you have already completed Programming Challenge 1. Design a class TimeOff. The purpose of the class is to track an employee's sick leave, vacation, and unpaid time off. It should have, as members, the following instances of the NumDays class described in Programming Challenge 1: maxSickDays: A NumDays object that records the maximum number of days of sick leave the employee may take. sickTaken: A NumDays object that records the number of days of sick leave the employee has already taken. maxVacation: A NumDays object that records the maximum number of days of paid vacation the employee may take. vacTaken: A NumDays object that records the number of days of paid vacation the employee has already taken. maxUnpaid: A NumDays object that records the maximum number of days of unpaid vacation the employee may take. unpaidTaken: A NumDays object that records the number of days of unpaid leave the employee has taken. Additionally, the class should have members for holding the employee's name and identification number. It should have an appropriate constructor and member functions for storing and retrieving data in any of the member objects. Input Validation: Company policy states that an employee may not accumulate more than 240 hours of paid vacation. The class should not allow the maxVacation object to store a value greater than this amount. Additional Notes To the Book: -Define all member functions inline in the .h file -Build the object and its members around the following skeleton of main(): -Only implement the members used in main() above. -The default constructor should set all variables as passed (except account for the input validation specified in the book wording of the exercise). -For the maxVacation error handling, print an error message on the screen, set the maxVacation variable to the maximum allowed, and continue the program normally. -If no values have been passed (as in 'test2' above), set all variables to zero or null ( employee name). -The members setSickTaken, setVacTaken, and setUnpaidTaken should add to the current value of their corresponding variables and subtract from their corresponding 'max' values (maxSickDays, etc.). -Define all members inline */ #include "NumDays.h" #include using namespace std; //# Class definition #// class TimeOff { private: NumDays maxSickDays, sickTaken, maxVacation, vacTaken, maxUnpaid, unpaidTaken; char name[100]; int id; public: TimeOff(char inname[100], int inid, float inMaxSickDays, float inSickTaken, float inMaxVacation, float inVacTaken, float inMaxUnpaid, float inUnpaidTaken) { strcpy(name, inname); if( inid > 0 ) { id = inid; }; maxSickDays.setDays(inMaxSickDays); sickTaken.setDays(inSickTaken); if( inMaxVacation > 240 ) { cout
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote