The owners of the Super Supermarket would like to have a program that computes t
ID: 3782174 • 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
grossPay
hourlyRate
Tax RegHours
parking
overtimehours
netpay
How do you do this using just basic v1.01 programing?
Explanation / Answer
//SuperMarket.java
import java.util.Scanner;
public class SuperMarket {
public static void main(String[] args) {
// TODO Auto-generated method stub
Scanner sc = new Scanner(System.in);
System.out.println("Enter employee id:");
int employeeID = sc.nextInt();
System.out.println("Enter hourly rate of pay:");
double hoursRate = sc.nextDouble();
System.out.println("Enter regular hours worked:");
int regularHours = sc.nextInt();
System.out.println("Enter regular hours worked:");
int overtimeHours = sc.nextInt();
double grossPayment = (regularHours * hoursRate) + (overtimeHours * (hoursRate * 1.5));
double totalTax = (grossPayment * 30)/100;
int parkingRate = 10;
double netPay = grossPayment - totalTax - parkingRate ;
System.out.println("Gross Pay is "+grossPayment);
System.out.println("Net Pay is "+netPay);
}
}
/*
Output:
Enter employee id:
1001
Enter hourly rate of pay:
20
Enter regular hours worked:
40
Enter regular hours worked:
5
Gross Pay is 950.0
Net Pay is 655.0
*/
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.