Answer to Question #264110 in C++ for cuteee

Question #264110

Write a program that able to compute the pay of both types of employees: retired one’s and employed,


the retired employees will receive pension and it will be computed and displayed with proper variables


and messages. The pension of the employer will be fixed and will be computed on the basis of age, if the


age of the retired employer is between 60 to 70 years then its pension will be 30000 and if the age is


greater than 70 then the pension will be 40000. The pay of the employer will be computed on daily


worked hours and the net pay will be shown with the proper messages of gross salary. The pay of the


employer will be 1000 rupees per day if he/she worked for 8 hours and if it works more than 8 hours, then


he will be paid 300 rupees per hour but the extra time can only be utilized at maximum of 3 hours.



1
Expert's answer
2021-11-10T14:51:20-0500
#include <iostream>


using namespace std;
class employed{
public:
      double pay=0,pension,gpay=0;
     int age,hours;
    void dispay(){
     cout<<"Enter the age of the employed"<<endl;
     cin>>age;
if(age<60){
   pension=0;}
   else if(age>=60 && age<=70){
    pension=30000;}
else if (age>70){
    pension=40000;}
  cout<<"Enter hours worked"<<endl;
 cin>>hours;
if (hours=0 &&hours>=8)
    gpay=1000*hours;


if(hours>8)
        gpay=(1000*8)+(hours-8)*300;


pay=gpay+pension;
cout<<"This the net pay for the employee: "<<pay<<endl;
}




};
class retired{
public:
    float pay=0,pension=0,gpay=0;
     int age=0,hours=0;
     void dispay(){
     cout<<"Enter the age of the employed"<<endl;
     cin>>age;
if(age>=60 && age<=70)
    pension=30000;
else if (age>70)
    pension=40000;
  cout<<"Enter hours worked"<<endl;
 cin>>hours;
if (hours>0 &&hours>=8){
    gpay=1000*hours;
     }
     else if(hours>8){
        gpay=(1000*8)+(hours-8)*300;
     }
      pay=gpay+pension;
      cout<<"This the net pay for the employee: "<<pay<<endl;
}};


int main()
{
    employed e;
    e.dispay();
    retired r;
    r.dispay();
    return 0;
}

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS