-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathCarToGo.java
More file actions
43 lines (36 loc) · 1.21 KB
/
Copy pathCarToGo.java
File metadata and controls
43 lines (36 loc) · 1.21 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
39
40
41
42
43
package ConditionalStatements;
import java.util.Scanner;
public class CarToGo {
public static void main(String[] args) {
Scanner scanner = new Scanner(System.in);
double budget = Double.parseDouble(scanner.nextLine());
String season = scanner.nextLine();
String carType = "";
String carClass = "";
double price = 0;
if(budget <= 100){
carClass = "Economy class";
if(season.equals("Summer")){
carType = "Cabrio";
price = budget * 0.35;
}else if(season.equals("Winter")){
carType = "Jeep";
price = budget * 0.65;
}
}else if(budget > 100 && budget <= 500){
carClass = "Compact class";
if(season.equals("Summer")){
carType = "Cabrio";
price = budget * 0.45;
}else if(season.equals("Winter")){
carType = "Jeep";
price = budget * 0.80;
}
}else {
carClass = "Luxury class";
carType = "Jeep";
price = budget * 0.90;
}
System.out.printf("%s%n%s - %.2f",carClass,carType,price);
}
}