Question

In: Computer Science

Write a C program that calculates a worker’s wages from their hours worked and hourly rate....

Write a C program that calculates a worker’s wages from their hours worked and hourly rate. This wage calculator should also account for overtime hours, calculate amount to be witheld from taxes, and calculate the final net income. Required functionality: 1. Ask the user for the number of hours worked and hourly rate in dollars. The program should be able to accept decimal values for both of these (e.g. 3.2 hours, 11.25 dollars/hour) 2. Overtime hours are those worked in excess of 40 hours per week. Overtime hours are billed at 1.5 times the hourly rate. 3. The taxes to be withheld from the user’s net income should be calculated. The tax rate is 15%. 4. Final net income should be calculated as: net income = normal income + overtime income – taxes withheld where normal income is the amount earned on the first 40 hours of work and overtime income the amount earned on all hours over 40. 5. All information should be printed to the screen in a nicely formated manner and look very close to the following example

my calculations are wrong on this. can anyone help out?

Solutions

Expert Solution

Answer to above question:

#include<stdio.h>

float cal_tax(float bill)
{
   float tax = 0.0;
   tax = (bill * 15)/100;
   return tax;
}

float final_income(float normal_inc,float OT,float tax)
{
   float net_income =0.0;
   net_income = normal_inc+OT-tax;
   return net_income;
}

float over_time(float hours,float rate)
{
   float bill =0.0;
   float excess_hours = hours - 40;

       bill = (excess_hours * 1.5 * rate) + 40 * rate;
       return bill;

}

float normal_income(float hours,float rate)
{
   float bill =0.0;
       bill = hours * rate;
       return bill;

}
int main()
{
   float hours1 = 0.0, rate1 = 0.0, n_i =0.0, o_t=0.0, tax1=0.0,tax2=0.0;
   printf("Number of Hours Worked\n");
   scanf("%f",&hours1);
   printf("Enter Hour Rate\n");
   scanf("%f",&rate1);
   n_i=normal_income(hours1,rate1);
   o_t = over_time(hours1,rate1);
tax2 = n_i+o_t;
   tax1=cal_tax(tax2);
   printf("Final Income %f\n",final_income(n_i,o_t,tax2));
   return 0;
}


Related Solutions

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...
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...
Write a C++ program that calculates mileage reimbursement for a salesperson at a rate of $...
Write a C++ program that calculates mileage reimbursement for a salesperson at a rate of $ 0.35 per mile. Your program should interact with the user in this manner: MILEAGE REIMBURSEMENT CALCULATOR Enter beginning odometer reading: 13505.2 Enter ending odometer reading     : 13810.6 You traveled 305.40 miles. At $ 0.35 per mile, your reimbursement is $ 106.89. The values in red color are inputs for the program. The values in blue color are results of expressions.
Write a program that calculates pay for either hourly paid workers or salaried workers. Hourly paid...
Write a 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 ◦ Bonus The program should also declare a structure with two members. Each member should be a...
Leticia Alvarez worked 40 hours straight time and 20 hours overtime at an hourly rate of...
Leticia Alvarez worked 40 hours straight time and 20 hours overtime at an hourly rate of $10.50. Of the 20 hours overtime, 8 hours were at double time. Compute the following: 30. Straight-time earnings = 31. Overtime earnings = 32. Gross earnings =
C++ write a program that asks the user to enter the hours and rate then calculate...
C++ write a program that asks the user to enter the hours and rate then calculate the gross pay for an employee, the program should test if the hours are regular (40), any hour more than 40 should be paid with the overtime rate: 1.5*rate. The program should ask repeatedly the user if he/she wants to continue: y or n, if the user types y, then the program should ask for the hours and rate for another employee then display...
1. An employee receives an hourly wage rate of $24, with time-and-a-half for all hours worked...
1. An employee receives an hourly wage rate of $24, with time-and-a-half for all hours worked in excess of 40 during the week. Payroll data for the current week are as follows: hours worked, 44; federal income tax withheld, $145; social security tax rate, 6.0%; Medicare tax rate, 1.5%; state unemployment compensation tax, 3.4% on the first $7,000; and federal unemployment compensation tax, 0.8% on the first $7,000. What is the net amount to be paid to the employee? Round...
Your task is to write a program in C or C++ that calculates the total amount...
Your task is to write a program in C or C++ that calculates the total amount of money a person has made over the last year. Your program will prompt the user for dollar amounts showing how much the user has made per job. Some users will have had more than one job, make sure your program allows for this. The program will print out the total made (all jobs) and will print out the federal and state taxes based...
Write a program where the main part of the program collects the data such as employee hours, hourly rate, state of residence, and marital status.
IN BASIC. all answers are in C++ , java but i need it in BASIC PLEASE.Write a program where the main part of the program collects the data such as employee hours, hourly rate, state of residence, and marital status.It then calls the function Calculatewages() function and sends employee hours and hourly rate.The Calculatewages () function would calculate the wages and sends it back to the main.The main program would use the wages returned by Calcualewages() function and send it...
Martin Jackson receives an hourly wage rate of $17, with time-and-a-half pay for all hours worked...
Martin Jackson receives an hourly wage rate of $17, with time-and-a-half pay for all hours worked in excess of 40 hours during a week. Payroll data for the current week are as follows: hours worked, 48; federal income tax withheld, $163; social security tax rate, 6.0%; and Medicare tax rate, 1.5%. What is the net amount to be paid to Jackson, rounded to the nearest cent?
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT