forked from angiejones/java-programming
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathSalaryCalculator.java
More file actions
35 lines (26 loc) · 810 Bytes
/
Copy pathSalaryCalculator.java
File metadata and controls
35 lines (26 loc) · 810 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
27
28
29
30
31
32
33
34
35
package chapter3;
import java.util.Scanner;
/*
IF Statement.
All salespeople get a payment of $1000 a week.
Salespeople who exceed 10 sales get an additional bonus of $250.
*/
public class SalaryCalculator {
public static void main(String args[]){
//Initialize known values
int salary = 1000;
int bonus = 250;
int quota = 10;
//Get values for the unknown
System.out.println("How many sales did the employee make this week?");
Scanner scanner = new Scanner(System.in);
int sales = scanner.nextInt();
scanner.close();
//Quick detour for the bonus earners
if(sales > quota){
salary = salary + bonus;
}
//Output
System.out.println("The employee's pay is $" + salary);
}
}