Advertisement
EliPerfanova

SmallShop

Sep 28th, 2019
119
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.72 KB | None | 0 0
  1. import java.util.Scanner;
  2.  
  3. public class SmallShop {
  4. public static void main(String[] args) {
  5. Scanner scanner = new Scanner(System.in);
  6. String prod = scanner.nextLine().toLowerCase();
  7. String city = scanner.nextLine().toLowerCase();
  8. double col = Double.parseDouble(scanner.nextLine());
  9. double price = 0;
  10.  
  11. if ("Sofia".equals(city)) {
  12. if ("coffee".equals(prod)) {
  13. price = 0.5;
  14. } else if ("water".equals(prod)) {
  15. price = 0.8;
  16. } else if ("beer".equals(prod)) {
  17. price = 1.2;
  18. } else if ("sweets".equals(prod)) {
  19. price = 1.45;
  20. } else if ("peanuts".equals(prod)) {
  21. price = 1.6;
  22. } else if ("Plovdiv".equals(city)) ;
  23. else if ("coffee".equals(prod)) {
  24. price = 0.4;
  25. } else if ("water".equals(prod)) {
  26. price = 0.7;
  27. } else if ("beer".equals(prod)) {
  28. price = 1.15;
  29. } else if ("sweets".equals(prod)) {
  30. price = 1.3;
  31. } else if ("peanuts".equals(prod)) {
  32. price = 1.5;
  33. } else if ("Varna".equals(city)) {
  34. if ("coffee".equals(prod)) {
  35. price = 0.5;
  36. } else if ("water".equals(prod)) {
  37. price = 0.8;
  38. } else if ("beer".equals(prod)) {
  39. price = 1.2;
  40. } else if ("sweets".equals(prod)) {
  41. price = 1.45;
  42. } else if ("peanuts".equals(prod)) {
  43. price = 1.6;
  44. }
  45.  
  46. }
  47.  
  48. } double result =price * col;
  49. System.out.println(result);
  50.  
  51. }}
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement