Advertisement
Kancho

Small_Shop

Jan 27th, 2019
644
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.05 KB | None | 0 0
  1. import java.util.Scanner;
  2.  
  3. public class Small_Shop {
  4. public static void main(String[] args) {
  5.  
  6. Scanner keyboard = new Scanner(System.in);
  7. System.out.print("Enter city: ");
  8. String city = keyboard.next();
  9. System.out.print("Enter product: ");
  10. String product = keyboard.next();
  11. System.out.print("Enter count: ");
  12. int count = keyboard.nextInt();
  13. switch (city) {
  14. case "Sofia":
  15. switch (product) {
  16. case "coffee":
  17. System.out.printf( "%.2f lv",count * 0.50);
  18. break;
  19. case "beer":
  20. System.out.printf( "%.2f lv", count * 1.20);
  21. break;
  22. case "water":
  23. System.out.printf( "%.2f lv",count * 0.80);
  24. break;
  25. case "sweets":
  26. System.out.printf( "%.2f lv", count * 1.45);
  27. break;
  28. case "peanuts":
  29. System.out.printf( "%.2f lv",count * 1.60);
  30. break;
  31. default:
  32. System.out.println("Non existent product");
  33. }
  34. break;
  35. case "Plovdiv":
  36. switch (product){
  37. case"coffee" :
  38. System.out.printf( "%.2f lv",count * 0.40);
  39. break;
  40. case"beer" :
  41. System.out.printf( "%.2f lv", count * 1.15);
  42. break;
  43. case"water" :
  44. System.out.printf( "%.2f lv",count * 0.70);
  45. break;
  46. case"sweets" :
  47. System.out.printf( "%.2f lv",count * 1.30);
  48. break;
  49. case"peanuts" :
  50. System.out.printf( "%.2f lv",count * 1.50);
  51. break;
  52. default:
  53. System.out.println("Non existent product");
  54. }
  55. break;
  56. case "Varna":
  57. switch (product) {
  58. case "coffee" :
  59. System.out.printf( "%.2f lv",count * 0.45);
  60. break;
  61. case "beer" :
  62. System.out.printf( "%.2f lv",count * 1.10);
  63. break;
  64. case "water" :
  65. System.out.printf( "%.2f lv",count * 0.70);
  66. break;
  67. case "sweets" :
  68. System.out.printf( "%.2f lv",count * 1.35);
  69. break;
  70. case "peanuts" :
  71. System.out.printf( "%.2f lv",count * 1.55);
  72. break;
  73. default:
  74. System.out.println("Non existent product");
  75. }
  76. break;
  77.  
  78. default:
  79. System.out.println("Non existent city");
  80.  
  81.  
  82. }
  83. }
  84. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement