Question

Styles Program Description Write a C++ program that computes and displays employees earnings. Prompt the user for type of employee (hourly (hor H) or management (m or M) If the employee is management: . get the annual salary get the pay period (weekly (w or W), bi-weekly (b or B) or monthly (m or e compute the gross salary for the pay period (Divide annual salary by 52 for weekly, 26 for bi-weekly, and 12 for monthly) deduct from gross pay: 7% for FICA, 2% for Medicare, 10% for health insurance e e print out gross pay, deductions for FICA, Medicare, health insurance, and net pay If the employee is hourly: . get the hourly rate of pay get the number of hours worked- assume it is for one week compute the gross pay as hourly rate for up to 40 hours and time-and a half for anything over that deduct from gross pay: 7% for FICA, 2% for Medicare, 10% for health insurance print out regular pay, overtime pay (only if the employee has earned it), gross pay deductions for FICA, Medicare, health insurance, and net pay Notes: Insert the top comment with your own description Create a nicely formatted output for your results. If you get any illegal input (characters other than the ones you expect at any time) let the user know and stop the program . Submission . Compile and run your program one last time before submitting it. . The name of your program file should be hw1.cpp. Upload your file to Blackboard. Check if the file was uploaded correctly
0 0
Add a comment Improve this question Transcribed image text
Answer #1

#include<iostream>

#include<cctype>

using namespace std;

/*To Show Error and Terminate Program*/

void error(char ch)

{

cout<<"Incorrect Input:\t"<<ch<<"\nTerminating Program";

exit(1);

}

int main()

{

char empType; //To store Employee Type

cout<<"Enter Employee Type:\t";

cin>>empType;

empType=toupper(empType);

//For Employee Type = Management

if(empType == 'M')

{

double annualSal;

char payPeriod;

double grossPay;

double FICA, Medicare, healthInsurance, netPay;

//User Data Input

cout<<"Enter Annual Salary:\t"; cin>>annualSal;

cout<<"Enter Pay Period:\t"; cin>>payPeriod;

payPeriod=toupper(payPeriod);

//Calulation of Gross Pay

if (payPeriod == 'W') grossPay=annualSal/52;

else if (payPeriod == 'B') grossPay=annualSal/26;

else if (payPeriod == 'M') grossPay=annualSal/12;

else error(payPeriod);

// Calulation of Various Deductions

FICA=grossPay*0.07; Medicare=grossPay*0.02; healthInsurance=grossPay*0.1;

netPay=grossPay-(FICA-Medicare-healthInsurance);

//Output Data

cout<<"\nGross Pay:\t\t"<<grossPay<<"\nFICA:\t\t\t"<<FICA;

cout<<"\nMedicare:\t\t"<<Medicare<<"\nHealth Insurance:\t"<<healthInsurance;

cout<<"\nNet Pay:\t\t"<<netPay;

}

// For Employee Type = Hourly

else if(empType == 'H')

{

double hourlyPay;

int noOfHours;

double grossPay, regularPay, overTimePay=0;

double FICA, Medicare, healthInsurance, netPay;

//User Data Input

cout<<"Enter Hourly Pay:\t"; cin>>hourlyPay;

cout<<"Enter No of Hours:\t"; cin>>noOfHours;

//Calulation of Regular Pay and Over Time Pay

if(noOfHours <= 40) regularPay=hourlyPay*noOfHours;

else{

regularPay=40*hourlyPay;

overTimePay=(noOfHours-40)*1.5*hourlyPay;

}

// Calulation of Gross Pay

grossPay=regularPay+overTimePay;

// Calulation of Various Deductions

FICA=grossPay*0.07; Medicare=grossPay*0.02; healthInsurance=grossPay*0.1;

netPay=grossPay-(FICA-Medicare-healthInsurance);

//Output Data

cout<<"\nRegular Pay:\t\t"<<regularPay;

if(overTimePay!=0) cout<<"\nOver Time Pay:\t\t"<<overTimePay;

cout<<"\nGross Pay:\t\t"<<grossPay<<"\nFICA:\t\t\t"<<FICA;

cout<<"\nMedicare:\t\t"<<Medicare<<"\nHealth Insurance:\t"<<healthInsurance;

cout<<"\nNet Pay:\t\t"<<netPay;

}

else error(empType);

return 1;

}

/*OUTPUT*/

/*In case of doubt do post in Comments Section!!!*/

Add a comment
Know the answer?
Add Answer to:
Styles Program Description Write a C++ program that computes and displays employees' earnings. Prompt the user...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • Before you begin, print out all the pages in this workbook. Franny's Fabric Coporation started operations...

    Before you begin, print out all the pages in this workbook. Franny's Fabric Coporation started operations on January 1, 2020. Various payroll transactions of Franny's occurred during January and February 2020. Click on "Transactions" tab at bottom of this page to view these. Required: 1 On the printed "Worksheet" page, journalize the transactions the information from the "Transactions" page. January Transactions 15 Paid an employee S. Moore net salary for January 1-15. Gross salary for the period is $1,500. Deductions...

  • Write a program that will compute the user annual salary. Prompt the user the enter (1)...

    Write a program that will compute the user annual salary. Prompt the user the enter (1) the weekly salary. Store the information in a double variable. Prompt the user to enter the number of weeks worked in a year. Use an int variable for that. Write code that will compute the user's Annual salary. Gross salary is salary before any deductions are taken. Update the code and prompt the user to enter the federal tax rate and the state's tax...

  • Program description: Write the necessary C++ statements (Program) to calculate the employee's weekly pay. Where :...

    Program description: Write the necessary C++ statements (Program) to calculate the employee's weekly pay. Where : Hour = employee's work hours Rate = employee's hourly pay Wages = employee's weekly pay Given that ( Hour= 31.5 and , Rate = $11.45) Write the variable declarations and initialization sections necessary to compute and print the required calculations. The program should ask the user to input the hours and Rate of pay, then calculate the weekly Wages. Hint: Modify program in project...

  • Stark Company has five employees. Employees paid by the hour earn $15 per hour for the...

    Stark Company has five employees. Employees paid by the hour earn $15 per hour for the regular 40-hour workweek and $20 per hour beyond the 40 hours per week. Hourly employees are paid every two weeks, but salaried employees are paid monthly on the last biweekly payday of each month. FICA Social Security taxes are 6.2% of the first $128,400 paid to each employee, and FICA Medicare taxes are 1.45% of gross pay. FUTA taxes are 0.6% and SUTA taxes...

  • Program Description: Write the pseudocode for a program that will calculate and display an employee’s gross...

    Program Description: Write the pseudocode for a program that will calculate and display an employee’s gross pay. Input the number of hours an employee worked for each of the 5 days of the week. Add them all up to get his hours worked for the week. Weekly Pay is calculated by adding an employee’s normal pay plus any overtime pay. Normal hours are paid at $10/hr. Any over time is paid at $15/hr. Any hours over 40 are considered overtime....

  • Stark Company has five employees. Employees paid by the hour earn $14 per hour for the...

    Stark Company has five employees. Employees paid by the hour earn $14 per hour for the regular 40 hour workweek and $19 per hour beyond the 40 hours per week. Hourly employees are paid every two weeks, but salaried employees are paid monthly on the last biweekly payday of each month. FICA Social Security taxes are 6.2% of the first $128,400 paid to each employee, and FICA Medicare taxes are 1.45% of gross pay. FUTA taxes are 0.6% and SUTA...

  • Franny's Fabric Coporation started operations on January 1, 2020. Various payroll transactions of Franny's occurred during...

    Franny's Fabric Coporation started operations on January 1, 2020. Various payroll transactions of Franny's occurred during January and February 2020. Click on "Transactions" tab at bottom of this page to view these. Required 1 On the printed "Worksheet" page, journalize the transactions the information from the "Transactions" page. Janua Transactions Paid an employee S. Moore net salary for January 1-15. Gross salary for the period is $1,500. Deductions from gross pay are as follows: The company Employee income taxes FICA...

  • Write a Java application with a class name of Payroll, for the “Travel Agency”, that willCalculate...

    Write a Java application with a class name of Payroll, for the “Travel Agency”, that willCalculate the weekly paycheck for both Salaried and Hourly employees. Salaried employees will be paid 1/52 of their annual pay minus 18% withheld for federal and state taxes, as well as 4% for retirement pension. Salaried employees do not collect overtime pay. There are two types of Hourly employees; permanent employees and temporary weekly employees. •Permanent weekly employees will be paid their hourly rate minus...

  • 1. Write a C++ program that will ask the user for their full name and calculate...

    1. Write a C++ program that will ask the user for their full name and calculate the user's weekly salary based on their hourly wage and the number of hours they worked, assuming no overtime at this point. Sample program run: Please enter first name: Elmer Please enter middle initial (Enter space if none): J Please enter last name: Fudd Enter hours worked: 37.5 Enter hourly rate: 10.35 Your name is: Elmer J. Fudd Your weekly salary is: $388.12 2....

  • A company pays its employees as managers (who receive a fixed weekly salary), hourly workers (who...

    A company pays its employees as managers (who receive a fixed weekly salary), hourly workers (who receive a fixed hourly wage for up to the first 40 hours they work and “time-and-a-half,” i.e. 1.5 times their hourly wage, for overtime hours worked), commission workers (who receive $250 plus 5.7% of their gross weekly sales), or pieceworkers (who receive a fixed amount of money per item for each of the items they produce-each pieceworker in this company works on only one...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT