Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public class MyClass {
- public static void main(String args[]) {
- java.util.Scanner scanner = new java.util.Scanner(System.in);
- String product = scanner.nextLine();
- String city = scanner.nextLine();
- double quantity = scanner.nextDouble();
- switch(product) {
- case "coffee" :
- switch(city) {
- case "Varna" :
- System.out.print(0.45 * quantity);
- break;
- case "Sofia" :
- System.out.print(0.5 * quantity);
- break;
- case "Plovdiv" :
- System.out.print(0.4 * quantity);
- break;
- } break;
- case "water" :
- switch(city) {
- case "Varna" :
- System.out.print(0.7 * quantity);
- break;
- case "Sofia" :
- System.out.print(0.8 * quantity);
- break;
- case "Plovdiv" :
- System.out.print(0.7 * quantity);
- break;
- } break;
- case "beer" :
- switch(city) {
- case "Varna" :
- System.out.print(1.1 * quantity);
- break;
- case "Sofia" :
- System.out.print(1.2 * quantity);
- break;
- case "Plovdiv" :
- System.out.print(1.15 * quantity);
- break;
- } break;
- case "sweets" :
- switch(city) {
- case "Varna" :
- System.out.print(1.35 * quantity);
- break;
- case "Sofia" :
- System.out.print(1.45 * quantity);
- break;
- case "Plovdiv" :
- System.out.print(1.3 * quantity);
- break;
- } break;
- case "peanuts" :
- switch(city) {
- case "Varna" :
- System.out.print(1.55 * quantity);
- break;
- case "Sofia" :
- System.out.print(1.6 * quantity);
- break;
- case "Plovdiv" :
- System.out.print(1.5 * quantity);
- break;
- } break;
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement