Question

please help, In this lab, you complete a C++ program with the provided data files. The program calculates the amount of...

please help,

In this lab, you complete a C++ program with the provided data files. The program calculates the amount of tax withheld from an employee’s weekly salary, the tax deduction to which the employee is entitled for each dependent, and the employee’s take- home pay. The program output includes state tax withheld, federal tax withheld, dependent tax deductions, salary, and take-home pay.

Instructions

  1. Ensure the source code file named Payroll.cpp is open in the code editor.

  2. Variables have been declared and initialized for you as needed, and the input and output statements have been written. Read the code carefully before you proceed to the next step.

  3. Write the C++ code needed to perform the following:

    • Calculate state withholding tax (stateTax) at 6.5 percent
    • Calculate federal withholding tax (federalTax) at 28.0 percent.
    • Calculate dependent deductions (dependentDeduction) at 2.5 percent of the employee’s salary for each dependent.
    • Calculate total withholding (totalWithholding) as stateTax+ federalTax + dependentDeduction.
    • Calculate take-home pay (takeHomePay) as salary - totalWithholding.
  4. Compile and execute your program by clicking the Run button. You should get the following output:
    State Tax: $81.25
    Federal Tax: $350
    Dependents: $62.5
    Salary: $1250
    Take-Home Pay: $756.25

This is the code

/ This program calculates an employee's take home pay.
#include <iostream>
using namespace std;
int main()
{
double salary = 1250.00;
double stateTax;
double federalTax;
double numDependents = 2;
double dependentDeduction;
double totalWithholding;
double takeHomePay;

// Calculate state tax here

cout << "State Tax: $" << stateTax << endl;
// Calculate federal tax here

cout << "Federal Tax: $" << federalTax << endl;
// Calculate dependent deduction here

cout << "Dependents: $" << dependentDeduction << endl;
// Calculate total withholding here

// Calculate take-home pay here

cout << "Salary: $" << salary << endl;

Thanks!

0 2
Add a comment Improve this question Transcribed image text
✔ Recommended Answer
Answer #1

Note: Could you plz go through this code and let me know if u need any changes in this.Thank You
_________________

#include <iostream>
#include <iomanip>
using namespace std;

int main()
{
   const double STATE_TAX=6.5;
   const double FEDERAL_TAX=28.0;
   const double DEPENDENTS_DEDUCTION=2.5;

double salary = 1250.00;
double stateTax;
double federalTax;
double numDependents = 2;
double dependentDeduction;
double totalWithholding;
double takeHomePay;

// Calculate state tax here
stateTax=salary*(STATE_TAX/100);
federalTax=salary*(FEDERAL_TAX/100);
dependentDeduction=salary*(DEPENDENTS_DEDUCTION/100)*numDependents;

cout << "State Tax: $" << stateTax << endl;
// Calculate federal tax here

cout << "Federal Tax: $" << federalTax << endl;
// Calculate dependent deduction here

cout << "Dependents: $" << dependentDeduction << endl;
// Calculate total withholding here
totalWithholding=stateTax+federalTax+dependentDeduction;
// Calculate take-home pay here
takeHomePay=salary-totalWithholding;
cout << "Salary: $" << salary << endl;
cout<<"Take-Home Pay: $"<<takeHomePay<<endl;
return 0;
}

_______________________________

Output:

CAProgram Files (x86)\Dev-Cpp\MinGW64\bin\StateTaxFederalTaxDependentsWith HeldTakeHom... State Tax: $81.25 Federal Tax: $350

_______________Could you plz rate me well.Thank You

Add a comment
Know the answer?
Add Answer to:
please help, In this lab, you complete a C++ program with the provided data files. The program calculates the amount of...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Similar Homework Help Questions
  • C++ Program The Ward Bus Manufacturing Company has recently hired you to help them convert their...

    C++ Program The Ward Bus Manufacturing Company has recently hired you to help them convert their manual payroll system to a computer-based system. Write a program to produce a 1-week payroll report for only one employee to serve as a prototype (model) for the administration to review. Input for the system will be the employee’s 4-digit ID number, the employee’s name, hours worked that week, and the employee’s hourly pay rate. Output should consist of the employee’s ID number, the...

  • You are to write a program that will process employees and their pay. For each employee...

    You are to write a program that will process employees and their pay. For each employee the program will read in an employee’s name and hourly pay rate. It should also read in the number of hours worked each day for 5 days and calculate his or her total number of hours worked. You must read the hours using a loop. The program should output the employee’s name, gross pay, total withholding amount and net pay. Withholding is made up...

  • In this lab, you complete a prewritten C++ program that calculates an employee’s productivity bonus and...

    In this lab, you complete a prewritten C++ program that calculates an employee’s productivity bonus and prints the employee’s name and bonus. Bonuses are calculated based on an employee’s productivity score as shown below. A productivity score is calculated by first dividing an employee’s transactions dollar value by the number of transactions and then dividing the result by the number of shifts worked. Productivity Score Bonus <=30 $50 31–69 $75 70–199 $100 >= 200 $200 Instructions Ensure the file named...

  • A) One of the problems that have been discussed in the class is to write a simple C++ program to ...

    C++ programming question will upvote A) One of the problems that have been discussed in the class is to write a simple C++ program to determine the area and circumference of a circle of a given radius. In this lab you will be rewriting the program again but this time you will be writing some functions to take care of the user input and math. Specifically, your main function should look like the following int main //the radius of the...

  • Has to be written in C#! Write a Windows Forms application that calculates and prints the...

    Has to be written in C#! Write a Windows Forms application that calculates and prints the take-home pay for a commissioned sales employee. Allow the user to enter values for the name of the employee and the sales amount for the week. Employees receive 7% of the total sales. Federal tax rate is 18%. Retirement contribution is 15%. Social Security tax rate is 9%. Use appropriate constants. Write Input, Display, and Calculate methods. Your final output should display all calculated...

  • plz help with this matlab program Write program that calculates the total amount of taxes a citizen has to pay based on...

    plz help with this matlab program Write program that calculates the total amount of taxes a citizen has to pay based on his/her income. Here is the rule: Federal tax 10% on income between $0 and $8025 15% on income between $8026 and $32550; plus $802.5 25% on income between $32551 and $78850; plus $4481.25 28% on income between $78851 and $164550; plus $16056.25 33% on income between $164551 and $357700; plus $40052.25 Social Security tax 6.2% of income above...

  • The program calculates a tax rate and tax to pay given an annual salary. The program...

    The program calculates a tax rate and tax to pay given an annual salary. The program uses a class, TaxTableTools, which has the tax table built in. Run the program with annual salaries of 10000, 50000, 50001, 100001 and -1 (to end the program) and note the output tax rate and tax to pay. The output should be as follows: Enter annual salary (-1 to exit): 10000 Annual Salary: 10000 Tax rate: 0.1 Tax to pay: 1000 Enter annual salary...

  • I need help with this code. I'm using C++ and Myprogramming lab to execute it. 11.7:...

    I need help with this code. I'm using C++ and Myprogramming lab to execute it. 11.7: Customer Accounts Write a program that uses a structure to store the following data about a customer account:      Customer name      Customer address      City      State      ZIP code      Telephone      Account balance      Date of last payment The program should use an array of at least 20 structures. It should let the user enter data into the array, change the contents of any element, and display all the...

  • Write a C# Windows Forms application that calculates and prints the take-home pay for a commissioned...

    Write a C# Windows Forms application that calculates and prints the take-home pay for a commissioned sales employee. Allow the user to enter values for the name of the employee and the sales amount for the week. Employees receive 7% of the total sales. Federal tax rate is 18%. Retirement contribution is 15%. Social Security tax rate is 9%. Use appropriate constants. Write Input, Display, and Calculate methods. Your final output should display all calculated values, including the total deductions...

  • Multiple Conditional Statements Summary In this lab, you complete a Python program that calculates an employee's...

    Multiple Conditional Statements Summary In this lab, you complete a Python program that calculates an employee's annual bonus. Input is an employee's first name, last name, salary, and numeric performance rating. If the rating is 1, 2, or 3, the bonus rate used is .25, .15, or .1 respectively. If the rating is 4 or higher, the rate is 0. The employee bonus is calculated by multiplying the bonus rate by the annual salary. Variables have been declared for you,...

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