Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.util.Scanner;
- public class Small_Shop {
- public static void main(String[] args) {
- Scanner keyboard = new Scanner(System.in);
- System.out.print("Enter city: ");
- String city = keyboard.next();
- System.out.print("Enter product: ");
- String product = keyboard.next();
- System.out.print("Enter count: ");
- int count = keyboard.nextInt();
- switch (city) {
- case "Sofia":
- switch (product) {
- case "coffee":
- System.out.printf( "%.2f lv",count * 0.50);
- break;
- case "beer":
- System.out.printf( "%.2f lv", count * 1.20);
- break;
- case "water":
- System.out.printf( "%.2f lv",count * 0.80);
- break;
- case "sweets":
- System.out.printf( "%.2f lv", count * 1.45);
- break;
- case "peanuts":
- System.out.printf( "%.2f lv",count * 1.60);
- break;
- default:
- System.out.println("Non existent product");
- }
- break;
- case "Plovdiv":
- switch (product){
- case"coffee" :
- System.out.printf( "%.2f lv",count * 0.40);
- break;
- case"beer" :
- System.out.printf( "%.2f lv", count * 1.15);
- break;
- case"water" :
- System.out.printf( "%.2f lv",count * 0.70);
- break;
- case"sweets" :
- System.out.printf( "%.2f lv",count * 1.30);
- break;
- case"peanuts" :
- System.out.printf( "%.2f lv",count * 1.50);
- break;
- default:
- System.out.println("Non existent product");
- }
- break;
- case "Varna":
- switch (product) {
- case "coffee" :
- System.out.printf( "%.2f lv",count * 0.45);
- break;
- case "beer" :
- System.out.printf( "%.2f lv",count * 1.10);
- break;
- case "water" :
- System.out.printf( "%.2f lv",count * 0.70);
- break;
- case "sweets" :
- System.out.printf( "%.2f lv",count * 1.35);
- break;
- case "peanuts" :
- System.out.printf( "%.2f lv",count * 1.55);
- break;
- default:
- System.out.println("Non existent product");
- }
- break;
- default:
- System.out.println("Non existent city");
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement