Advertisement
Dido09

03.WorldSnookerChampionship

Nov 1st, 2019
215
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.40 KB | None | 0 0
  1. import java.util.Scanner;
  2.  
  3. public class WorldSnooker {
  4. public static void main(String[] args) {
  5. Scanner scanner = new Scanner(System.in);
  6.  
  7. String championship = scanner.nextLine();
  8. String ticketType = scanner.nextLine();
  9. int ticketCount = Integer.parseInt(scanner.nextLine());
  10. String picture = scanner.nextLine();
  11. double ticketPrice = 0;
  12.  
  13. switch (championship) {
  14. case "Quarter final":
  15. switch (ticketType) {
  16. case "Standard":
  17. ticketPrice = 55.5;
  18. break;
  19. case "Premium":
  20. ticketPrice = 105.2;
  21. break;
  22. case "VIP":
  23. ticketPrice = 118.9;
  24. break;
  25. }
  26. break;
  27. case "Semi final":
  28. switch (ticketType) {
  29. case "Standard":
  30. ticketPrice = 75.88;
  31. break;
  32. case "Premium":
  33. ticketPrice = 125.22;
  34. break;
  35. case "VIP":
  36. ticketPrice = 300.40;
  37. break;
  38. }
  39. break;
  40. case "Final":
  41. switch (ticketType) {
  42. case "Standard":
  43. ticketPrice = 110.10;
  44. break;
  45. case "Premium":
  46. ticketPrice = 160.66;
  47. break;
  48. case "VIP":
  49. ticketPrice = 400;
  50. break;
  51. }
  52.  
  53. break;
  54.  
  55. }
  56.  
  57. double totalPrice = ticketPrice * ticketCount;
  58.  
  59. if (totalPrice > 4000) {
  60. totalPrice *= 0.75;
  61. } else if (totalPrice > 2500) {
  62. totalPrice *= 0.9;
  63.  
  64. if (picture.equals("Y")) {
  65. double pictureTotalPrice = ticketCount * 40;
  66. totalPrice += pictureTotalPrice;
  67. }
  68.  
  69. } else {
  70. if (picture.equals("Y")) {
  71. double pictureTotalPrice = ticketCount * 40;
  72. totalPrice += pictureTotalPrice;
  73. }
  74. }
  75. System.out.printf("%.2f", totalPrice);
  76.  
  77. }
  78. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement