Question

Create a payroll program named CalcPay that allows the user to enter two double valuesand a...

Create a payroll program named CalcPay that allows the user to enter two double valuesand a string namely hours worked, hourly rate and name. After the user enters the rate, hours,and name the program should calculate the gross pay. Compute federal withholding tax which is subtracted from gross based on the following table: Hints: (100pts) Use methods as deemed appropriate. 0 to 99.99 6% 100.00 to 299.99 12% 300.00 to 599.99 18% 600.00 and up 21%. Display the output. The display should include: Name, hours, rate, deduct, gross and net. You should also display the same using printf.

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

Code-->

#include <stdio.h>
void calcPay(char name[],double hoursWorked,double hourlyRate)
{
double grossPay=hoursWorked*hourlyRate;
double withHoldingTax;
if(grossPay<100)
{
withHoldingTax=0.06*grossPay;
}
else if(grossPay<300)
{
withHoldingTax=0.12*grossPay;
}
else if(grossPay<600)
{
withHoldingTax=0.18*grossPay;
}
else
{
withHoldingTax=0.21*grossPay;
}
double netPay=grossPay-withHoldingTax;
printf("Name is: %s ",name);
printf("Hours Worked %lf ",hoursWorked);
printf("Hourly Rate %lf ",hourlyRate);
printf("Deduct %lf ",withHoldingTax);
printf("Gross Pay %lf ",grossPay);
printf("Net Pay %lf ",netPay);
return;
}
int main()
{
char name[100];
scanf("%s",name);
double hoursWorked;
double hourlyRate;
scanf("%lf",&hoursWorked);
scanf("%lf",&hourlyRate);
calcPay(name,hoursWorked,hourlyRate);
return 0;
}

Input---->

John
10
100

Output-->

Name is: John
Hours Worked 10.000000
Hourly Rate 100.000000
Deduct 210.000000
Gross Pay 1000.000000
Net Pay 790.000000

Any doubt ask in comments section.Please Upvote.Thanks and Regards

Add a comment
Know the answer?
Add Answer to:
Create a payroll program named CalcPay that allows the user to enter two double valuesand a...
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
  • Create a payroll program named CalcPay that allows the user to enter two double valuesand a...

    Create a payroll program named CalcPay that allows the user to enter two double valuesand a string namely hours worked, hourly rate and name. After the user enters the rate, hours,and name the program should calculate the gross pay. Compute federal withholding tax which is subtracted from gross based on the following table: Hints: (100pts) Use methods as deemed appropriate. 0 to 99.99 6% 100.00 to 299.99 12% 300.00 to 599.99 18% 600.00 and up 21%. Display the output. The...

  • Create an applet payroll program named CalcPay that allows the user to enter two double valuesand...

    Create an applet payroll program named CalcPay that allows the user to enter two double valuesand a string namely hours worked, hourly rate and name. After the user enters the rate, hours,and name the program should calculate the gross pay by pressing CALCULATE button. Compute federal withholding tax which is subtracted from gross based on the following table: Hints: (100pts) Use methods as deemed appropriate. 0 to 99.99 6% 100.00 to 299.99 12% 300.00 to 599.99 18% 600.00 and up...

  • use at least two functions in your program. . Write a program that calculates weekly payment....

    use at least two functions in your program. . Write a program that calculates weekly payment. The program will ask the user full name, ID number (make one up), and hours worked. An hourly worker’s gross pay is basically his/her work hours that week multiplied by his/her regular hourly pay rate. However, after the first 40 work hours of the week, each additional work hour is paid at an overtime rate that is 1.5 times of the regular hourly rate....

  • chapter 7. Create a program that allows the user to enter the ages (in years) of...

    chapter 7. Create a program that allows the user to enter the ages (in years) of five people. The program should display the average age. Use the for the statement. Display the average age with one decimal place. If necessary, create a new project named TryThis15 Project, and save it in the Cpp8\Chap07 folder. Enter the C++ instructions into a source file named TryThis15.cpp. Also, enter appropriate comments and any additional instructions required by the compiler. Test the program using...

  • ASAP Please. Python Program Description Create an object-oriented program that allows you to enter data for...

    ASAP Please. Python Program Description Create an object-oriented program that allows you to enter data for employees. Specifications Create an abstract Employee class that provides private attributes for the first name, last name, email address, and social security number. This class should provide functions that set and return the employee’s first name, last name, email address, and social security number. This class has a function: get_net_income which returns 0. Create a Manager class that inherits the Employee class. This class...

  • Write a contacts database program that presents the user with a menu that allows the user...

    Write a contacts database program that presents the user with a menu that allows the user to select between the following options: (In Java) Save a contact. Search for a contact. Print all contacts out to the screen. Quit If the user selects the first option, the user is prompted to enter a person's name and phone number which will get saved at the end of a file named contacts.txt. If the user selects the second option, the program prompts...

  • 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...

  • Styles Program Description Write a C++ program that computes and displays employees' earnings. Prompt the user...

    Styles Program Description Write a C++ program that computes and displays employees' earnings. Prompt the user for type of employee (hourly ("h"or "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...

  • Create a Java file named Ch6Asg.java that contains a public class named Ch6Asg containing a main()...

    Create a Java file named Ch6Asg.java that contains a public class named Ch6Asg containing a main() method. Within the same file, create another class named Employee, and do not declare it public. Create a field for each of the following pieces of information: employee name, employee number, hourly pay rate, and overtime rate. Create accessor and mutator methods for each field. The mutator method for the hourly pay rate should require the value to be greater than zero. If it...

  • Design a Payroll class with the following fields:

    IN JAVADesign a Payroll class with the following fields:• name: a String containing the employee's name• idNumber: an int representing the employee's ID number• rate: a double containing the employee's hourly pay rate• hours: an int representing the number of hours this employee has workedThe class should also have the following methods:• Constructor: takes the employee's name and ID number as arguments• Accessors: allow access to all of the fields of the Payroll class• Mutators: let the user assign values...

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