The owners of the Super Supermarket would like to have a program that computes t
ID: 3534799 • Letter: T
Question
The owners of the Super Supermarket would like to have a program that
computes the monthly gross pay of their employees as well as the
employee’s net pay. The input for this program is an employee ID number,
hourly rate of pay, and number of regular and overtime hours worked.
Gross pay is the sum of the wages earned from regular hours and overtime
hours; overtime is paid at 1.5 times the regular rate. Net pay is gross pay
minus deductions. Assume that deductions are taken for tax withholding
(30 percent of gross pay) and parking ($10 per month). You will need the
following variables:
EmployeeID
(a String) HourlyRate (a Float) RegHours (a Float)
GrossPay
(a Float) Tax (a Float) Parking (a Float)
OvertimeHours
(a Float) NetPay (a Float)
You will need the following formulas:
GrossPay = RegularHours * HourlyRate + OvertimeHours * (HourlyRate * 1.5)
NetPay = GrossPay – (GrossPay * Tax) – Parking
I
Explanation / Answer
Here is your programme in JAVA
import java.util.Scanner;
public class NewClass {
public static void main( String []args ){
Scanner stdin = new Scanner(System.in);
System.out.print("Enter The Number of employee : ");
int n;
n = stdin.nextInt();
int i = 0;
String ID [] = new String[n];
float Hrate [] = new float[n];
float Rhr [] = new float[n];
float Ohr [] = new float[n];
for( i =0 ;i< n; i++){
float grosspay ;
float netpay;
System.out.print("Enter the ID of "+ (i+1) + " employee : " );
ID[i] = stdin.next();
System.out.print("Enter the Hourlyrate of "+ (i+1) + " employee : " );
Hrate[i] = stdin.nextFloat();
System.out.print("Enter the Regular Hour of "+ (i+1) + " employee : " );
Rhr[i] = stdin.nextFloat();
System.out.print("Enter the OverTime hour of "+ (i+1) + " employee : " );
Ohr[i] = stdin.nextFloat();
grosspay = (float) ((Hrate[i]*Rhr[i]) + ( 1.5* Hrate[i]* Ohr[i]));
System.out.print("Gross income of " + (i+1) + " employee : " + grosspay + " " );
netpay = (float) (( 0.70*grosspay ) - 10);
System.out.print("Net income of " + (i+1) + " employee : " + grosspay+ " " );
}
}
}
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.