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. The program will ask the user fu

ID: 672548 • Letter: W

Question

Write a program that calculates weekly payment. 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

Explanation / Answer

#include<iostream>
using namespace std;
main()
{
   char id[10];
   string name;
   float gross,rate;
   cout<<"enter your full name: ";
   getline (cin, name);
   int hours;
   cout<<"enter your id: ";
   cin>>id;
   cout<<"enter the number of hours worked: ";
   cin>>hours;
   cout<<"enter the hourly rate: ";
   cin>>rate;
   int temp=hours-40,sum;
   cout<<"Name: "<<name;
   cout<<" ID#: "<<id;
   cout<<" Hours worked: "<<hours;
   gross=rate*40;
   cout<<" Regular weekly hours: $"<<gross;
   if(hours>40)
   {
       sum=temp*(1.5*rate);
       cout<<" Additional "<<temp<<" hours worked: $"<<sum;
       gross=sum+gross;
   }
   cout<<" Gross Pay: $"<<gross;  
   float tax;
   tax=(5.00/100)*gross;
   cout<<" Tax: $"<<tax;
   gross=gross-tax;
   cout<<" Net Pay: $"<<gross;                                          
}

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