aneliabogeva

Small shop

Nov 10th, 2020
41
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. import java.util.Scanner;
  2. import java.util.function.DoubleBinaryOperator;
  3.  
  4. public class BiggerNumber {
  5. public static void main(String[] args) {
  6. Scanner scanner = new Scanner(System.in);
  7. String product = scanner.nextLine();
  8. String town = scanner.nextLine();
  9. double quantity = Double.parseDouble(scanner.nextLine());
  10.  
  11. switch (product) {
  12. case "coffee":
  13. if(town.equals("Sofia")){
  14. System.out.println(quantity*0.50);
  15. }else if(town.equals("Plovdiv")){
  16. System.out.println(quantity*0.40);
  17. }else if(town.equals("Varna")){
  18. System.out.println(quantity*0.45);
  19. }
  20. break;
  21. case "water":
  22. if(town.equals("Sofia")){
  23. System.out.println(quantity*0.80);
  24. }else if(town.equals("Plovdiv")){
  25. System.out.println(quantity*0.70);
  26. }else if(town.equals("Varna")){
  27. System.out.println(quantity*0.70);
  28. }
  29. break;
  30. case "beer":
  31. if(town.equals("Sofia")){
  32. System.out.println(quantity*1.20);
  33. }else if(town.equals("Plovdiv")){
  34. System.out.println(quantity*1.15);
  35. }else if(town.equals("Varna")){
  36. System.out.println(quantity*1.10);
  37. }
  38. break;
  39. case "sweets":
  40. if(town.equals("Sofia")){
  41. System.out.println(quantity*1.45);
  42. }else if(town.equals("Plovdiv")){
  43. System.out.println(quantity*1.30);
  44. }else if(town.equals("Varna")){
  45. System.out.println(quantity*1.35);
  46. }
  47. break;
  48. case "peanuts":
  49. if(town.equals("Sofia")){
  50. System.out.println(quantity*1.60);
  51. }else if(town.equals("Plovdiv")){
  52. System.out.println(quantity*1.50);
  53. }else if(town.equals("Varna")){
  54. System.out.println(quantity*1.55);
  55. }
  56. break;
  57. default:
  58. System.out.println("unknown");
  59. }
  60. }
  61. }
  62.  
RAW Paste Data