Question

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. For example if the user’s hourly rate is $15 and worked for 48 hours, the additional 8 hours will be paid at $22.50/hour. Use 5% as tax deduction. The program will calculate and display the net payment. The following is a sample of the program output: Enter your first and last name: Jane Doe ID number: E1007 Hours worked: 48.0 Hourly rate: 15.0 Name: Jane Doe ID# E1007 Hours worked: 48.00 Regular weekly hours: $600.00 Additional 8 hours worked: $180.00 Gross Pay: $780.00 5% Tax: $39.00 Net Pay: $741.00

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

public class TestEmployeePayroll {
public static void main (String[] args)
{
ReadKb KB = new ReadKb();
int category;
String fName1, lName1, id1, fName2, lName2, id2;
double hoursWorked1, grossPay1, netPay1, hoursWorked2, grossPay2, netPay2, payRate;
category=0;
System.out.println(" enter empolyees first name;");
fName2= KB.getString();
System.out.println("enter empolyees last name;");
lName2=KB.getString();
System.out.println(" enter employees idenification number");
id2=KB.getString();
System.out.println(" enter hours worked by the employee;");
hoursWorked2=KB.getDouble();
System.out.println("enter employees pay category;");
payRate=KB.getDouble();
if(category==1)
{
payRate=55;
}
else if(category==2)
{
payRate=30;
}
else if(category==3)
{
payRate=25;
}
else
{
payRate=20;
}//end if
EmployeePayroll E1 = new EmployeePayroll;
fName1=E1.GetFirstName();
lName1=E1.GetLastName();
id1=E1.GetId();
hoursWorked1=E1.GetHoursWorked();
grossPay1=E1.GetGrossPay();
netPay1=E1.GetNetPay();
System.out.println(" Pay slip for " + fName1 + " " + lName1 + ". Identification Number: " + id1 +".");
System.out.println("Hours Worked: " + hoursWorked1);
System.out.println("Gross Pay: " + grossPay1);
System.out.println("Net Pay: " + netPay1);
EmployeePayroll E2 = new EmployeePayroll(fName2, lName2, id2, hoursWorked2, payRate);
fName2=E2.GetFName();
lName2=E2.GetLName();
id2=E2.GetId();
hoursWorked2=E2.GetHoursWorked();
grossPay2=E2.GetGrossPay();
netPay2=E2.GetNetPay();
System.out.println("Pay slip for " + fName2 + " " + lName2 + ". Identification Number: " + id2 +".");
System.out.println("Hours Worked: " + hoursWorked2);
System.out.println("Gross Pay: " + grossPay2);
System.out.println("Net Pay: " + netPay2);
}
}

Add a comment
Know the answer?
Add Answer to:
use at least two functions in your program. . Write a program that calculates weekly payment....
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
  • Develop a WPF application that has a button to calculate an employee’s weekly pay, given the...

    Develop a WPF application that has a button to calculate an employee’s weekly pay, given the number of hours worked. An employee should have a first name, last name, age, and hourly consulting rate. You should be able to create an employee object and provide the hours worked to calculate the weekly pay. The application assumes a standard workweek of 40 hours. Any hours worked over 40 hours in a week are considered overtime and earn time and a half....

  • Python 3 Question Please keep the code introductory friendly and include comments. Many thanks. Prompt: The...

    Python 3 Question Please keep the code introductory friendly and include comments. Many thanks. Prompt: The owners of the Annan Supermarket would like to have a program that computes the weekly gross pay of their employees. The user will enter an employee’s first name, last name, the hourly rate of pay, and the number of hours worked for the week. In addition, Annan Supermarkets would like the program to compute the employee’s net pay and overtime pay. Overtime hours, any...

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

  • Weekly rate ($1,827 x 12)/52-$421.615 rounded to $421.62 Hourly rate $421.62/40 $10.540 rounded to $10.54 OT....

    Weekly rate ($1,827 x 12)/52-$421.615 rounded to $421.62 Hourly rate $421.62/40 $10.540 rounded to $10.54 OT. rate $10.54 x 1.5 $15.81 se the minimum hourly wage of $7,25 in solving these problems eand all that follow Example 2-7 Joanne French works a 40-hour week at S 12.40 an hour with overtime hours paid at 1 ½ times the regular rate Regular weekly earnings are The overtime rate is Ir French works 4 hours overtime, additional earnings for the 4 hours...

  • COMPUTING OVERTIME RATE OF PAY AND GROSS WEEKLY PAY Mike Fritz receives a regular salary of...

    COMPUTING OVERTIME RATE OF PAY AND GROSS WEEKLY PAY Mike Fritz receives a regular salary of $3,250 a month and is paid 1½ times the regular hourly rate for hours worked in excess of 40 week. per (a) Calculate Fritz's overtime rate of pay. (Compute to the nearest half cent.) (b) Calculate Fritz's total gross weekly pay if he works 46 hours during the week.

  • Design a program(Creating a RAPTOR flowchart) that will read a file of employee records containing employee...

    Design a program(Creating a RAPTOR flowchart) that will read a file of employee records containing employee number, employee name, hourly pay rate, regular hours worked and overtime hours worked. The company pays its employees weekly, according to the following rules: regular pay = regular hours worked × hourly rate of pay overtime pay = overtime hours worked × hourly rate of pay × 1.5 total pay = regular pay + overtime pay Your program is to read the input data...

  • Exercise 1 A program was created that outputs the following unto the console: Hello! What is...

    Exercise 1 A program was created that outputs the following unto the console: Hello! What is your name: Hello, Jane Doe! Using this program, we can help you determine you pay for the week! Please enter the hours you worked this week: 20 Next, please enter your rate of pay: 10 Calculating… you will make $ 200 by the end of the week! Here is the code for that program (you should have written a close variant of this last...

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

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

  • Determine the weekly gross earnings for Michelle. Her regular rate of pay is $13.50 an hour,...

    Determine the weekly gross earnings for Michelle. Her regular rate of pay is $13.50 an hour, with time and a half paid for all hours over 8 in a given day. Find her gross earnings for the week. S M T W TH F S Total Hours Reg - 8 8 6.5 8 7.5 - OT - 3 1.5 - 2.5 - - Jane Doe is single and claims 2 withholding allowances. Jane has weekly earnings of $520. Her deductions...

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