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

Write a program that calculates weekly payment. Use two functions The program wi

ID: 673465 • Letter: W

Question

Write a program that calculates weekly payment. Use two functions The program will ask the user full name, ID number (make one up), and hours worked. An hourly worker’s gross pay is basically his/her work hours that week multiplied by his/her regular hourly pay rate. However, after the first 40 work hours of the week, each additional work hour is paid at an overtime rate that is 1.5 times of the regular hourly rate. For example if the user’s hourly rate is $15 and worked for 48 hours, the additional 8 hours will be paid at $22.50/hour. Use 5% as tax deduction. The program will calculate and display the net payment. The following is a sample of the program output: Enter your first and last name: Jane Doe ID number: E1007 Hours worked: 48.0 Hourly rate: 15.0 Name: Jane Doe ID# E1007 Hours worked: 48.00 Regular weekly hours: $600.00 Additional 8 hours worked: $180.00 Gross Pay: $780.00 5% Tax: $39.00 Net Pay: $741.00

1. // function is to calulate returns gross pay

2. // function that will calculate and returne net pay

Explanation / Answer

#include<iostream.h>
#include<conio.h>

class a
{
public:
   char name[20];
   char id[5];
   int whr;

   void getdata()
   {
       cout<<"Enter your first and last name";
       cin>>name;
  
       cout<<"ID number";
       cin>>id;

       cout<<"Hours worked";
       cin>>whr;
   }

   void cal()
   {
       float hr=15.0;
       float dif=whr-40;
       float difcal=0,gross,net,regu,tax;
      
       if(dif>0)
       {
           regu=40*15;

           difcal=dif*22.5;
           gross = regu+difcal;
       }
       else
       {
           regu = whr*15;
           gross=regu;
       }
       tax=gross*5/100;
       net=gross-tax;
  
       cout<<"Name: "<<name;
       cout<<"ID#: "<<id;
       cout<<"Hours worked: "<<whr;
       cout<<"Regular weely hours"<<regu;
       cout<<"Additional "<<dif<<" hours worked: "<<difcal;
       cout<<"Gross Pay: "<<gross;
       cout<<"5% Tax : "<<tax;
       cout<<"Net Pay: "<<net;
       getch();
   }
};


      

void main()
{
   a o;
   o.getdata();
   o.cal();
}
  

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