Advertisement
MilaDimitrovaa

Kvartalono magazintsce

Dec 1st, 2019
210
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 1.52 KB | None | 0 0
  1. package magazin;
  2.  
  3. import java.util.Scanner;
  4.  
  5. public class magazin {
  6.  
  7.     public static void main(String[] args) {
  8.         Scanner scan = new Scanner(System.in);
  9.        
  10.         String product = scan.nextLine();
  11.         double price = 0;
  12.         double kolitchestvo;
  13.         String grad = scan.nextLine();
  14.        
  15.        
  16.         kolitchestvo = scan.nextDouble();
  17.         if(grad.equals("Sofia")) {
  18.             if(product.equals("coffee")) {
  19.                 price = 0.50*kolitchestvo;
  20.             }else if(product.equals("water")){
  21.                 price = 0.80*kolitchestvo;
  22.             }else if (product.equals("beer")) {
  23.                 price = 1.20*kolitchestvo;
  24.                
  25.             }else if (product.equals("sweets")) {
  26.                 price = 1.45 * kolitchestvo;
  27.             }else if (product.equals("peanuts")) {
  28.                 price = 1.60*kolitchestvo;
  29.             }
  30.            
  31. }
  32.         if(grad.equals("Plovdiv")) {
  33.         if(product.equals("coffee")) {
  34.             price = 0.40*kolitchestvo;
  35.         }else if(product.equals("water")){
  36.             price = 0.70*kolitchestvo;
  37.         }else if (product.equals("beer")) {
  38.             price = 1.15*kolitchestvo;
  39.            
  40.         }else if (product.equals("sweets")) {
  41.             price = 1.30 *kolitchestvo;
  42.         }else if (product.equals("peanuts")) {
  43.             price = 1.50*kolitchestvo;
  44.         }
  45.        
  46. }   if(grad.equals("Varna")) {
  47.     if(product.equals("coffee")) {
  48.         price = 0.45*kolitchestvo;
  49.     }else if(product.equals("water")){
  50.         price = 0.70*kolitchestvo;
  51.     }else if (product.equals("beer")) {
  52.         price = 1.10*kolitchestvo;
  53.        
  54.     }else if (product.equals("sweets")) {
  55.         price = 1.35 * kolitchestvo;
  56.     }else if (product.equals("peanuts")) {
  57.         price = 1.55*kolitchestvo;
  58.     }
  59.    
  60. }
  61. System.out.println(price);
  62.  
  63.     }
  64.  
  65. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement