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 of state tax, federal tax, and FICA. For the purposes of this program the state tax will be 1.25% of the gross pay. FICA will be 7.65% of the gross pay. Federal tax will be 15% of the gross pay if the gross pay is under $500 and 25% otherwise.
You do not know how many employees there are but there will be a sentinel for the employee names. The sentinel is “done”. All output should be neatly labeled with money looking like money. No global variables may be used. Information must be passed in functions. The program must have the following functions: • Read and return the employee name • Read and return the pay rate • Given the gross pay, calculate and return the total withholding amount • Display payroll information about an employee in a nice format
Code Screenshots:
Output Screenshots:
Explanation:
First create an employee class with instance variables pay-rate, name and array of int for number of hours worked.
Then create a constructor with string and double parameters, which call setter functions of employee name , employee pay-rate and hours worked.
getGross() method will traverse over the hrs[] and increment the result with (hrs[i]*payRate) and returns the result.
getWH() method will calculate the total withHolding amount by the formula mentioned above and returns its value.
getNet() will call getGross() and getWH() and returns the difference between them.
PrintEmp() method will print all the employee details in the format with dollar symbols.
Check code for clarity:
import java.util.*;
class EMP15{
double payrate;
String name;
int[] hrs = new int[5];
EMP15(String s,double d){
this.setName(s); this.setPR(d);
this.readHrs();
}
public void setName(String nm){ this.name = nm; return;}
public String getName(){ return this.name; }
public void setPR(double d) {this.payrate = d; return;}
public double getPR(){ return this.payrate; }
public void readHrs(){
Scanner sc = new Scanner(System.in);
System.out.print("Enter no. of worked hours for 5 days : ");
for(int i=0;i<5;i++){
hrs[i] = sc.nextInt();
}
}
public double getGross(){
double grs = 0;
for(int i=0;i<5;i++) grs = grs + (payrate*hrs[i]);
return grs;
}
public double getWH(){
double st,fc,ft,grs;
grs = this.getGross();
st = 0.0125*grs; fc = 0.0765*grs;
if(grs<500) ft = 0.15*grs;
else ft = 0.25*grs;
return (st+fc+ft);
}
public double getNet(){
return (this.getGross()-this.getWH());
}
public void printEmp(){
System.out.print("\nEmployee name : "+this.name+"\n");
System.out.print("GrossPay : $"+this.getGross()+"\n");
System.out.print("withHolding amt : $"+this.getWH()+"\n");
System.out.print("NetPay : $"+this.getNet()+"\n");
}
public static void main(String args[]){
Scanner sc = new Scanner(System.in);
System.out.print("Enter 'done' insted of name when you are done..\n");
String s; double d;
while(true) {
System.out.print("\nEnter name of employee and payrate : ");
s = sc.next(); if(s.equals("done")) break;
d = sc.nextDouble();
EMP15 e = new EMP15(s,d);
e.printEmp();
}
}
}
You are to write a program that will process employees and their pay. For each employee...
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...
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...
Quiz Company is preparing the payroll report and wants to look at one particular employee. The following data is available for a recent week: Hours Worked: 60 Hourly Pay Rate: $20.00 Federal Withholding: 25% FICA Withholding: 6.20% Medicare Withholding: 1.45% Illinois Withholding: 5% 401-K Deduction: 5% (employer matches) Federal and State Unemployment: 6% Required . Calculate the gross pay Calculate the net pay Calculate the total cost to the employer Calculate the % of total cost to gross pay for...
Program Gross Pay. Implement this program using functions. Please pay attention to the requirements Function should have 1 parameter for gross salary. Return is net salary. Print out employee name and net salary. Write a program to fetch employee name and the salary. Calculate the Federal tax and state tax based on the following criteria: If the salary is greater than 100000 then calculate the federal tax at 15% otherwise calculate the federal tax at 10% Calculate the state tax...
Program Description: Write the pseudocode for a program that will calculate and display an employee’s gross pay. Input the number of hours an employee worked for each of the 5 days of the week. Add them all up to get his hours worked for the week. Weekly Pay is calculated by adding an employee’s normal pay plus any overtime pay. Normal hours are paid at $10/hr. Any over time is paid at $15/hr. Any hours over 40 are considered overtime....
write a program that reads the following information and prints a payroll statement Employees name (Smith) number of hours worked in a week(e.g.,10) hourly pay rate (e.g.,9.75) federal tax withholding (e.g. ,20%) state tax withholding (e.g., 9%) in python
The Payroll Department keeps a list of employee information for each pay period in a text file. The format of each line of the file is the following: <last name> <hourly wage> <hours worked> Write a program that inputs a filename from the user and prints to the terminal a report of the wages paid to the employees for the given period. The report should be in tabular format with the appropriate header. Each line should contain: An employee’s name...
J Inc. has a file with employee details. You are asked to write a C++ program to read the file and display the results with appropriate formatting. Read from the file a person's name, SSN, and hourly wage, the number of hours worked in a week, and his or her status and store it in appropriate vector of obiects. For the output, you must display the person's name, SSN, wage, hours worked, straight time pay, overtime pay, employee status and...
Programming Exercise 4.12 The Payroll Department keeps a list of employee information for each pay period in a text file. The format of each line of the file is the following: <last name> <hours worked> <hourly wage> Write a program that inputs a filename from the user and prints to the terminal a report of the wages paid to the employees for the given period. The report should be in tabular format with the appropriate header. Each line should contain:...
Paloma Co. has four employees. FICA Social Security taxes are 6.2% of the first $118,500 paid to each employee, and FICA Medicare taxes are 1.45% of gross pay. Also, for the first $7,000 paid to each employee, the company’s FUTA taxes are 0.6% and SUTA taxes are 2.15%. The company is preparing its payroll calculations for the week ended August 25. Payroll records show the following information for the company’s four employees. Current WeekNameGross Paythrough Aug. 18Gross PayIncome Tax WithholdingDali$117,500$2,100$298Trey117,700800129Kiesha7,20046040Chee1,15041031 In addition...