Gross Pay Calculator
Gross Pay Calculator
Scanner;
public class try1
{
public static void main(String[] args) {
Scanner get = new Scanner(System.in);
if (fullOrPart.equals("F")){
System.out.print("Monthly Salary: ");
Double salaryF = get.nextDouble();
System.out.println("Enter eployee name: " + employeeName);
System.out.println("Press F for Full Time or P for Part Time: " +
fullOrPart);
System.out.println("---Full Time Employee---");
System.out.println("Enter Basic Pay: " + salaryF);
System.out.println("__________________________________");
System.out.println("Employee Name: " + employeeName);
System.out.println("Basic Pay: " + salaryF);
System.out.println("__________________________________");
System.out.println("Gross Pay: " + salaryF);
} else if (fullOrPart.equals("P")){
System.out.print("Enter rate per hour: ");
Double wageP = get.nextDouble();
System.out.print("Enter no. of hours worked: ");
Double numberHoursWork = get.nextDouble();
System.out.print("Enter no. of overtime: ");
Double numberOvertime= get.nextDouble();
Double basicPay = wageP * numberHoursWork;
Double overtimePay = numberOvertime * (wageP * 1.25);
Double grossPay = basicPay + overtimePay;
System.out.println("Enter employee name: " + employeeName);
System.out.println("Press F for Full Time or P for Part Time: " +
fullOrPart);
System.out.println("---Part Time Employee---");
System.out.println("Enter rate per hour: " + wageP);
System.out.println("Enter no. of hours worked: " + numberHoursWork);
System.out.println("Enter no. of overtime: " + numberOvertime);
System.out.println("__________________________________");
System.out.println("Employee Name: " + employeeName);
System.out.printf("Basic Pay: ");
System.out.printf("%.2f", basicPay);
System.out.println("");
System.out.printf("Overtime Pay: ");
System.out.printf("%.2f", overtimePay);
System.out.println("");
System.out.println("__________________________________");
System.out.printf("Gross Pay: ");
System.out.printf("%.2f", grossPay);
System.out.println("");
} else {
System.out.println("There's is an error in your Full time or Part time
input...");
System.out.println("Please try again...");
}
}
}