An employee’s total weekly pay equals the hourly wage multiplied by the total number of regular hours plus any. Overtime pay equals the total overtime hours multiplied by 1.5 times the hourly wage. Write a program that takes as input the hourly wage. Total regular hours. And total overtime hours and displays an employee’s total weekly pay.
#include <iostream>
using namespace std;
int main()
{
double n,p,h,e;
cout<<"Enter the hourly wage: ";
cin>>p; //Taking wages from user
cout<<"Enter the regular hours: ";
cin>>h; //Taking no of regular hours
cout<<"Enter the no of extra hours: ";
cin>>e; //Taking no of extra hours
n = p * h + (p * 1.5 * e); //Calculating weekly pay
cout<<"Total weekly pay is: "<<n; //Printing weekly
pay
return 0;
}
Output:-
Get Answers For Free
Most questions answered within 1 hours.