-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathSalary.java
More file actions
26 lines (21 loc) · 920 Bytes
/
Salary.java
File metadata and controls
26 lines (21 loc) · 920 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
import java.util.Scanner;/**
* Salary
*/
public class Salary {
public static void main(String[] args) {
float hourlyPayRate;
float regularHours, overTimeHours;
Scanner input= new Scanner(System.in);
System.out.print("Enter the hourly pay rate for the employee: ");
hourlyPayRate=input.nextFloat();
System.out.print("Enter the regular hours for the employee: ");
regularHours= input.nextFloat();
System.out.print("Enter over time hours for the employee: ");
overTimeHours = input.nextFloat();
System.out.print("Over time pay: "+ calcOvertimePay(regularHours,hourlyPayRate,overTimeHours)+"\n");
input.close();
}
public static float calcOvertimePay(float regHours,float payRate,float overTimeHours) {
return(float)((regHours*payRate)+(overTimeHours*1.5*payRate));
}
}