Advertisement
anonymous2222

Untitled

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