-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathBikeRace.java
More file actions
38 lines (30 loc) · 1.08 KB
/
Copy pathBikeRace.java
File metadata and controls
38 lines (30 loc) · 1.08 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
26
27
28
29
30
31
32
33
34
35
36
37
38
package ConditionalStatements;
import java.util.Scanner;
public class BikeRace {
public static void main(String[] args) {
Scanner scanner = new Scanner(System.in);
int juniors = Integer.parseInt(scanner.nextLine());
int seniors = Integer.parseInt(scanner.nextLine());
String type = scanner.nextLine();
double totalMoney = 0;
switch(type){
case "trail":
totalMoney = juniors * 5.50 + seniors * 7.00;
break;
case "cross-country":
totalMoney = juniors * 8.00 + seniors * 9.50;
if((juniors + seniors) >= 50){
totalMoney = totalMoney - (totalMoney * 0.25);
}
break;
case "downhill":
totalMoney = juniors * 12.25 + seniors * 13.75;
break;
case "road":
totalMoney = juniors * 20.00 + seniors * 21.50;
break;
}
totalMoney = totalMoney - (totalMoney * 0.05);
System.out.printf("%.2f",totalMoney);
}
}