Advertisement
GabrielHr00

01. Cinema

May 28th, 2023
202
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.81 KB | None | 0 0
  1. package S3_ConditionalStatementsAdvanced;
  2.  
  3. import java.util.Scanner;
  4.  
  5. public class Cinema {
  6.     public static void main(String[] args) {
  7.         Scanner scanner = new Scanner(System.in);
  8.         String showType = scanner.nextLine();
  9.         int rows = Integer.parseInt(scanner.nextLine());
  10.         int columns = Integer.parseInt(scanner.nextLine());
  11.  
  12.         int seats = rows * columns;
  13.         double finalPrice = 0.0;
  14.  
  15.         switch (showType) {
  16.             case "Premiere":
  17.                 finalPrice = 12.0 * seats;
  18.                 break;
  19.             case "Normal":
  20.                 finalPrice = 7.50 * seats;
  21.                 break;
  22.             case "Discount":
  23.                 finalPrice = 5.0 * seats;
  24.                 break;
  25.         }
  26.  
  27.         System.out.printf("%.2f leva", finalPrice);
  28.  
  29.     }
  30. }
  31.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement