-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsmallShop.java
More file actions
58 lines (55 loc) · 1.86 KB
/
Copy pathsmallShop.java
File metadata and controls
58 lines (55 loc) · 1.86 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
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
import java.util.Scanner;
public class smallShop {
public static void main(String[] args) {
Scanner scanner = new Scanner(System.in);
String product = scanner.nextLine();
String city = scanner.nextLine();
double amount = Double.parseDouble(scanner.nextLine());
double coffee,water,beer,sweets,peanuts,productPrize = 0;
switch (product){
case "coffee":
if (city.equals("Sofia")) {
productPrize = 0.50;
}else if (city.equals("Plovdiv")) {
productPrize = .40;
}else {
productPrize = .45;
}
break;
case "water":
if (city.equals("Sofia")) {
productPrize = 0.80;
}else {
productPrize = .7;
}
break;
case "beer":
if (city.equals("Sofia")){
productPrize = 1.20;}
else if (city.equals("Plovdiv")){
productPrize =1.15;
}else {
productPrize = 1.10;
}
break;
case "sweets":
if (city.equals("Sofia")){
productPrize = 1.45;}
else if(city.equals("Plovdiv")){
productPrize = 1.30;
}else{productPrize=1.35;}
break;
case "peanuts":
if(city.equals("Sofia")){
productPrize = 1.60;}
else if(city.equals("Plovdiv")){
productPrize = 1.50;
}else{productPrize = 1.55;}
break;
default:
System.out.println("error");
break;
}
System.out.println(productPrize * amount);
}
}