Advertisement
knoteva

Untitled

Nov 3rd, 2019
142
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 2.32 KB | None | 0 0
  1. import java.util.Scanner;
  2.  
  3. public class MetricConvert {
  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.                 break;
  26.             case "Semi final":
  27.                 switch (ticketType) {
  28.                     case "Standard":
  29.                         ticketPrice = 75.88;
  30.                         break;
  31.                     case "Premium":
  32.                         ticketPrice = 125.22;
  33.                         break;
  34.                     case "VIP":
  35.                         ticketPrice = 300.4;
  36.                         break;
  37.                 }
  38.                 break;
  39.                     case "Final":
  40.                         switch (ticketType) {
  41.                             case "Standard":
  42.                                 ticketPrice = 110.1;
  43.                                 break;
  44.                             case "Premium":
  45.                                 ticketPrice = 160.66;
  46.                                 break;
  47.                             case "VIP":
  48.                                 ticketPrice = 400;
  49.                                 break;
  50.                         }
  51.                 break;
  52.  
  53.         }
  54.  
  55.         double totalPrice = ticketPrice * ticketCount;
  56.         //System.out.println(totalPrice);
  57.  
  58.         if (totalPrice > 4000) {
  59.             totalPrice *= 0.75;
  60.         } else if (totalPrice > 2500) {
  61.             totalPrice *= 0.9;
  62.  
  63.         }
  64.         if (picture.equals("Y") && totalPrice <= 4000) {
  65.             double pictureTotalPrice = ticketCount * 40;
  66.             totalPrice += pictureTotalPrice;
  67.         }
  68.         System.out.printf("%.2f", totalPrice);
  69.     }
  70. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement