Question

In: Computer Science

In C Program #include Create a C program that calculates the gross and net pay given...

In C Program

#include

Create a C program that calculates the gross and net pay given a user-specified number of hours worked, at minimum wage.

  • The program should compile without any errors or warnings (e.g., syntax errors)
  • The program should not contain logical errors such as subtracting values when you meant to add (e.g.,
    logical errors)
  • The program should not crash when running (e.g., runtime errors)
    When you run the program, the output should look like this:

Hours per Week: 30

Hourly Rate: $7.25

Gross Pay: $217.50
Net Pay: $176.06

Deductions

Federal: $21.75

State: $3.05

FICA: $13.49

Medicare: $3.15

Note, the only value the user provides is 30 hours per week

Solutions

Expert Solution

#include <stdio.h>

#define HOURLY_RATE 7.25

#define FEDERAL_DEDUCTION 21.75

#define STATE_DEDUCTION 3.05

#define FICA_DEDUCTION 13.49

#define MEDICARE_DEDUCTION 3.15

int main(void)

{

int hours;

printf("\nEnter the number of hours worked per week: ");

scanf("%d", &hours);

printf("\nHours per Week: %d\n", hours);

printf("\nHourly Rate: $%.2f\n", HOURLY_RATE);

double grossPay = (hours * HOURLY_RATE);

printf("Gross Pay: $%.2f\n", grossPay);

printf("\nDeductions:\n");

printf("Federal: $%.2f\n", FEDERAL_DEDUCTION);

printf("State: $%.2f\n", STATE_DEDUCTION);

printf("FICA: $%.2f\n", FICA_DEDUCTION);

printf("Medicare: $%.2f\n\n", MEDICARE_DEDUCTION);

double netPay = (grossPay - (FEDERAL_DEDUCTION + STATE_DEDUCTION + FICA_DEDUCTION + MEDICARE_DEDUCTION));

printf("Net Pay: $%.2f\n", netPay);

return 0;

}

******************************************************************** SCREENSHOT *******************************************************


Related Solutions

Develop a C++ program that will determine the gross pay and net pay (after taxes). Each...
Develop a C++ program that will determine the gross pay and net pay (after taxes). Each employee pays a flat tax of 150.00 on the first 1000.00 dollars earned. If the employee earns less than 1000.00 dollars then he/she pays no taxes. Taxes are computed at 15.5% on all earnings over 1000.00 dollars if the number of dependents is 3 or less and 12.5% if the number of dependents are 4 or more. Sample input/outpt dialog Enter # of yours...
In C++, Write a program that calculates pay for either an hourly paid worker or a...
In C++, Write a program that calculates pay for either an hourly paid worker or a salaried worker. Hourly paid workers are paid their hourly pay rate times the number of hours worked. Salaried workers are paid their regular salary plus any bonus they may have earned. The program should declare two structures for the following data: Hourly Paid: HoursWorked HourlyRate Salaried: Salary Bonus The program should also declare a union with two members. Each member should be a structure...
Modify the provided code to create a program that calculates the amount of change given to...
Modify the provided code to create a program that calculates the amount of change given to a customer based on their total. The program prompts the user to enter an item choice, quantity, and payment amount. Use three functions: • bool isValidChoice(char) – Takes the user choice as an argument, and returns true if it is a valid selection. Otherwise it returns false. • float calcTotal(int, float) – Takes the item cost and the quantity as arguments. Calculates the subtotal,...
Create a small program that calculates the final grade in this course, given the different assignments...
Create a small program that calculates the final grade in this course, given the different assignments and exams you will be required to take. The program should ask for all the grades through the semester, and as a final output it should compute the weighted average as well as give the final letter grade. You should use the syllabus for this course to calculate the final grade. • Five assignments worth 30 points each. • Three projects worth 100 points...
Create a C # program that calculates what a worker must be paid if each day...
Create a C # program that calculates what a worker must be paid if each day I work different hours during the week. The price per hour is 80.0.
Create a C++ program which will accept an unlimited number of scores and calculates the average...
Create a C++ program which will accept an unlimited number of scores and calculates the average score. You will also need to prompt for the total points possible. Assume each test is worth 100 points. Requirements. • Enter the Student ID first, then prompt for grades. Keep prompt- ing for grades until the client enters ’calc’. That triggers final pro- cessing. • Make your code as reliable as possible. • Make your program output easy to read. • You cannot...
Write a C++ program that calculates pay for either hourly paid workers or salaried workers.
Write a C++ program that calculates pay for either hourly paid workers or salaried workers. Hourly paid workers are paid their hourly pay rate times the number of hours worked. Salaried workers are payed their regular salary plus any bonus they may have earned. The program should declare two structures for the following data:• Hourly Paid◦ HoursWorked◦ HourlyRate• Salaried◦ Salary◦ BonusThe program should also declare a structure with two members. Each member should be a structure variable: one for the...
Develop a C++ program that will determine the gross pay and netpay (after taxes). Each...
Develop a C++ program that will determine the gross pay and net pay (after taxes). Each employee pays a flat tax of 150.00 on the first 1000.00 dollars earned. If the employee earns less than 1000.00 dollars then he/she pays no taxes. Taxes are computed at 15.5% on all earnings over 1000.00 dollars if the number of dependents is 3 or less and 12.5% if the number of dependents are 4 or more.
Create a C++ program that calculates an unbiased standard deviation of 5 input numbers. Please Submit:...
Create a C++ program that calculates an unbiased standard deviation of 5 input numbers. Please Submit: 1. A flowchart of your program. (3 points) 2. Your C++ program with a heading comment, also appropriate spacing and indentation in the program body. 3. Copy of a screenshot after your program is executed. (Section 2 and3: 7 points) /* ELEN 1301 Programming Assignment #8. Name : Your name. Student ID : Your student ID #. Due date : Purpose of the program...
Create a Python program that will calculate the user’s net pay based on the tax bracket...
Create a Python program that will calculate the user’s net pay based on the tax bracket he/she is in. Your program will prompt the user for their first name, last name, their monthly gross pay, and the number of dependents. The number of dependents will determine which tax bracket the user ends up in. The tax bracket is as followed: 0 – 1 Dependents : Tax = 20% 2 – 3 Dependents : Tax = 15% 4+ Dependents :    Tax...
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT