Write a class Work whose objects represent working times (in whole minutes) and salary rates (in whole cents per minute). With this class, the following operation shall be possible:
void main() {
Work* w = new Work(25, 60);
w->add(65);
w->printSalary();
Work::reset(*w);
// 25 cent/min, 60 min
// add 65 minutes working time
// prints salary "31,25" (25*125 Cents)
// reset working time to zero
bool okay = w->subtract(60);
// attempts to subtract 60 minutes //returns false, if not sufficient time //available (time remains unchanged)
Work *v = new Work(30);
// 30 cent/min, 0 min
int r = w->compare(*v);
// 0 if salaries of w and *v are equal,
// 1, if w’s salary is bigger, -1, else
Work m;
cin>> m ;
Work u(m);
}
// 0 cent/min , 0 min
// Read salary rates and working time //from Keyboard
// u becomes a copy of m
1
Expert's answer
2020-04-16T03:19:48-0400
Dear sama, your question requires a lot of work, which neither of our experts is ready to perform for free. We advise you to convert it to a fully qualified order and we will try to help you. Please click the link below to proceed: Submit order
Comments
Leave a comment