Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Programming: Compute Wages (output base, overtime, and gross pay) Write a progra

ID: 3669652 • Letter: P

Question

Programming: Compute Wages (output base, overtime, and gross pay)

Write a program that reads in the name and salary of an employee. Here the salary will denote an hourly wage, such as $9.25. Then ask how many hours the employee worked in the past week. Be sure to accept fractional hours. Compute the pay. Any overtime work (over 40 hours per week) is paid at 150 percent of the regular wage. Print a paycheck for the employee.

Programming: Compute Wages (output base, overtime, and gross pay)

Write a program that reads in the name and salary of an employee. Here the salary will denote an hourly wage, such as $9.25. Then ask how many hours the employee worked in the past week. Be sure to accept fractional hours. Compute the pay. Any overtime work (over 40 hours per week) is paid at 150 percent of the regular wage. Print a paycheck for the employee.

Explanation / Answer

package employeewages;

import java.util.*;

public class EmployeeWages {

public static void main(String[] args) {

Scanner in = new Scanner(System.in);

System.out.println("Enter Employee name");

String employee =in.next();

System.out.println("Enter employee salary");

float hourlyWage = in.nextFloat();

double minwage =hourlyWage/60;

System.out.println("Enter working hours of past week");

double workingHours=in.nextDouble();

double workingHoursMin =workingHours*60;

int workingHoursExtra =(int) (workingHoursMin-2400);

if(workingHoursExtra>0){

double noramalWage=(minwage)*2400;

double Extraamount =(1.5)*(minwage);

double payAmount =noramalWage+workingHoursExtra*Extraamount;

System.out.println((int)payAmount);

}

else{

double noramalWage=minwage*workingHoursMin;

double payAmount =noramalWage;

System.out.println((int)payAmount);

}

  

  

  

}

}