Advertisement
veronikaaa86

03. World Snooker Championship

Aug 13th, 2022
962
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 2.01 KB | None | 0 0
  1. package examPrep;
  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 countTickets = 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 allTicketSum = price * countTickets;
  42.  
  43.         if (allTicketSum > 4000) {
  44.             allTicketSum = allTicketSum * 0.75;
  45.         } else if (allTicketSum > 2500) {
  46.             allTicketSum = allTicketSum * 0.90;
  47.             if (trophyPhoto.equals("Y")) {
  48.                 allTicketSum = allTicketSum + (countTickets * 40);
  49.             }
  50.         } else {
  51.             if (trophyPhoto.equals("Y")) {
  52.                 allTicketSum = allTicketSum + (countTickets * 40);
  53.             }
  54.         }
  55.  
  56.         System.out.printf("%.2f", allTicketSum);
  57.     }
  58. }
  59.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement