66 819
Assignments Done
99,1%
Successfully Done
In October 2018

Answer to Question #47535 in C++ for jacky

Question #47535
Input:
name of employee, position in the company, no. of hours worked, no. of overtime hours, rate per hour.
Formula:
Basic pay= no. of hours worked x rate per hour
OT pay= overtime hours x 150% of rate per hour
Gross pay = basic pay + OT pay
total ded= tax+sss+med

Expert's answer
#include <iostream>
using namespace std;
//main method
int main()
{
//variable for name Employee
char nameEmployee[15];
//variable for position In Company
int positionInCompany;
//variable for no HoursWorked
int noHoursWorked;
//variable for noOvertimeHours
int noOvertimeHours;
//variable for ratePerHour
double ratePerHour;
double BasicPay,pay,GrossPay,TotalDed;
//name of employee, position in the company, no. of hours worked, no. of overtime hours, rate per hour.
//promt user to enter name Employee 
cout<<"Enter name of employee: ";
//read name Employee
cin>>nameEmployee;
//enter position in the company
cout<<"Enter position in the company: ";
//read position in the company
cin>>positionInCompany;
cout<<"Enter no. of hours worked: ";
//read no. of hours worked
cin>>noHoursWorked;
cout<<"Enter no. of overtime hours: ";
//read no. of hours worked
cin>>noOvertimeHours;
cout<<"Enter rate per hour: ";
//read no. of hours worked
cin>>ratePerHour;

//Basic pay= no. of hours worked x rate per hour 
BasicPay=noHoursWorked*ratePerHour;
//pay= overtime hours x 150% of rate per hour 
pay=noOvertimeHours*150*ratePerHour/100;
//Gross pay = basic pay + OT pay
GrossPay=BasicPay+pay;
//total ded= tax+sss+med
TotalDed=BasicPay+pay+GrossPay;
//show result
cout<<"Basic pay = $"<<BasicPay<<"\n";
cout<<"Pay = $"<<pay<<"\n";
cout<<"Gross pay = $"<<GrossPay<<"\n";
cout<<"Total Ded = $"<<TotalDed<<"\n";
//delay
system("pause");
//exit program
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 first!

Leave a comment

Ask Your question

Submit
Privacy policy Terms and Conditions