Advertisement
Guest User

Untitled

a guest
Jun 16th, 2019
78
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.86 KB | None | 0 0
  1. import java.util.Scanner;
  2.  
  3. public class P02_izpitnaZadacha {
  4. public static void main(String[] args) {
  5. Scanner scanner = new Scanner(System.in);
  6. String nameOFTheMovie = scanner.nextLine();
  7. String packetForFIlm = scanner.nextLine();
  8. int tickets = Integer.parseInt(scanner.nextLine());
  9.  
  10. double price = 0;
  11. if ("John Wick".equals(nameOFTheMovie)){
  12. switch (packetForFIlm){
  13. case "Drink":
  14. price = price + 12;
  15. break;
  16. case "Popcorn":
  17. price = price + 18;
  18. break;
  19. case "Menu":
  20. price = price + 9;
  21. break;
  22. }
  23. }else if ("Star Wars".equals(nameOFTheMovie)){
  24. switch (packetForFIlm){
  25. case "Drink":
  26. price = price + 15;
  27. break;
  28. case "Popcorn":
  29. price = price + 25;
  30. break;
  31. case "Menu":
  32. price = price + 11;
  33. break;
  34. }
  35. }else if ("Jumanji".equals(nameOFTheMovie)){
  36. switch (packetForFIlm){
  37. case "Drink":
  38. price = price + 19;
  39. break;
  40. case "Popcorn":
  41. price = price + 30;
  42. break;
  43. case "Menu":
  44. price = price + 14;
  45. break;
  46. }
  47. }
  48. price = price * tickets;
  49. if (tickets >= 4 && nameOFTheMovie.equals("Star Wars")){
  50. price = price * 0.70;
  51. }else if (nameOFTheMovie.equals("Jumanji") && tickets == 2){
  52. price = price * 0.85;
  53. }
  54. System.out.printf("Your bill is %.2f leva." , price);
  55. }
  56. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement