-
Notifications
You must be signed in to change notification settings - Fork 5.7k
Expand file tree
/
Copy pathMain.java
More file actions
25 lines (21 loc) · 1.02 KB
/
Main.java
File metadata and controls
25 lines (21 loc) · 1.02 KB
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
import java.util.Scanner;
public class Main {
public static double calculateSalary(double hoursPerWeek, double payRate, int vacationDays){
double result = hoursPerWeek * payRate * 4 * 12 - vacationDays * 8 * payRate;
return result;
}
public static void main(String[] args){
System.out.println("Enter number of hours work per week:");
Scanner input = new Scanner(System.in);
double hoursPerWeek = Double.valueOf(input.next());
//System.out.println("Number of hours work per week is:" + hoursPerWeek);
System.out.println("Enter pay rate per hour:");
double payRate = Double.valueOf(input.next());
//System.out.println("Pay rate is:" + payRate);
System.out.println("Number of vacation days taken:");
int vacationDays = Integer.valueOf(input.next());
double grossSalary= calculateSalary(hoursPerWeek,payRate, vacationDays);
System.out.println("Employee salary:" + grossSalary);
//Testing 2
}
}