Advertisement
veronikaaa86

03. World Snooker Championship

Aug 14th, 2021
185
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.06 KB | None | 0 0
  1. package examPreparation;
  2.  
  3. import java.util.Scanner;
  4.  
  5. public class P03WorldSnookerChampionship {
  6. public static void main(String[] args) {
  7. Scanner scanner = new Scanner(System.in);
  8.  
  9. String tournamentStage = scanner.nextLine();
  10. String typeTicket = scanner.nextLine();
  11. int ticketsCount = Integer.parseInt(scanner.nextLine());
  12. String trophyPhoto = scanner.nextLine();
  13.  
  14. double price = 0;
  15. if (typeTicket.equals("Standard")) {
  16. if (tournamentStage.equals("Quarter final")) {
  17. price = 55.50;
  18. } else if (tournamentStage.equals("Semi final")) {
  19. price = 75.88;
  20. } else if (tournamentStage.equals("Final")) {
  21. price = 110.10;
  22. }
  23. } else if (typeTicket.equals("Premium")) {
  24. if (tournamentStage.equals("Quarter final")) {
  25. price = 105.20;
  26. } else if (tournamentStage.equals("Semi final")) {
  27. price = 125.22;
  28. } else if (tournamentStage.equals("Final")) {
  29. price = 160.66;
  30. }
  31. } else if (typeTicket.equals("VIP")) {
  32. if (tournamentStage.equals("Quarter final")) {
  33. price = 118.90;
  34. } else if (tournamentStage.equals("Semi final")) {
  35. price = 300.40;
  36. } else if (tournamentStage.equals("Final")) {
  37. price = 400;
  38. }
  39. }
  40.  
  41. double allTicketsPrice = price * ticketsCount;
  42.  
  43. if (allTicketsPrice > 4000) {
  44. allTicketsPrice = allTicketsPrice * 0.75;
  45. } else if (allTicketsPrice > 2500) {
  46. allTicketsPrice = allTicketsPrice * 0.90;
  47. if (trophyPhoto.equals("Y")) {
  48. allTicketsPrice = allTicketsPrice + (ticketsCount * 40);
  49. }
  50. } else {
  51. if (trophyPhoto.equals("Y")) {
  52. allTicketsPrice = allTicketsPrice + (ticketsCount * 40);
  53. }
  54. }
  55.  
  56. System.out.printf("%.2f", allTicketsPrice);
  57. }
  58. }
  59.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement