Design a program that calculates and prints the payroll amounts for an employee.
ID: 3584914 • Letter: D
Question
Design a program that calculates and prints the payroll amounts for an employee. It accepts the hourly rate and number of hours worked. It calculates gross pay, net pay. Overtime pay is based on time-and-a-half. Income tax is simply based on gross annual amounts (0-$6000-0%; $6000-9000-15%; $9000-12000 = 18%; $12000-18000-21%; $18000-21000 24%; S21000-25000 = 27%:S25000-30000-30002530000-3300) Social security tax is 8.9% of gross pay. P.S. Annual salary is multiplication of the weekly salary times 52 which is the number of weeks in a year, . Show in flowchart designExplanation / Answer
#include<iostream>
using namespace std;
int main(){
double hr_rate;
double num_hours;
double tax;
double sec_tax;
double overtime_hours; // overtime rate is 1.5 times the normal hourly rate
cout << "Enter number of hours:" << endl;
cin >> num_hours;
cout << "Enter hourly rate:" << endl;
cin >> hr_rate;
cout << "Enter overtime hours:" << endl;
cin >> overtime_hours;
tax = 0;
sec_tax = 0;
double grosspay = (num_hours * hr_rate + overtime_hours * (1.5 * hr_rate)) * 52;
if (grosspay > 6000 && grosspay <= 9000){
tax = 0.15 * grosspay;
}
if (grosspay > 9000 && grosspay <= 12000){
tax = 0.18 * grosspay;
}
if (grosspay > 12000 && grosspay <= 18000){
tax = 0.21 * grosspay;
}
if (grosspay > 18000 && grosspay <= 21000){
tax = 0.24 * grosspay;
}
if (grosspay > 21000 && grosspay <= 25000){
tax = 0.27 * grosspay;
}
if (grosspay > 25000 && grosspay <= 30000){
tax = 0.3 * grosspay;
}
if (grosspay > 30000){
tax = 0.33 * grosspay;
}
sec_tax = .089 * grosspay;
double net_pay = grosspay - (sec_tax + tax);
cout << "Net pay is " << net_pay << endl;
}
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.