Advertisement
Valantina

FilmPremiere

Jun 18th, 2019
122
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 1.72 KB | None | 0 0
  1. import java.util.Scanner;
  2.  
  3. public class P03_FilmPremiere {
  4.     public static void main(String[] args) {
  5.         Scanner scan = new Scanner(System.in);
  6.  
  7.         String film = scan.nextLine();
  8.         String type = scan.nextLine();
  9.         int ticketsCount = Integer.parseInt(scan.nextLine());
  10.  
  11.         double price = 0.0;
  12.  
  13.         switch (film) {
  14.             case "John Wick":
  15.                 if ("Drink".equals(type)) {
  16.                     price += 12 * ticketsCount;
  17.                 } else if ("Popcorn".equals(type)) {
  18.                     price += 15 * ticketsCount;
  19.                 } else if ("Menu".equals(type)) {
  20.                     price += 19 * ticketsCount;
  21.                 }
  22.                 break;
  23.             case "Star Wars":
  24.                 if ("Drink".equals(type)) {
  25.                     price += 18 * ticketsCount;
  26.                 } else if ("Popcorn".equals(type)) {
  27.                     price += 25 * ticketsCount;
  28.                 } else if ("Menu".equals(type)) {
  29.                     price += 30 * ticketsCount;
  30.                 }
  31.                 if (ticketsCount >= 4) {
  32.                     price *= 0.7;
  33.                 }
  34.                 break;
  35.             case "Jumanji":
  36.                 if ("Drink".equals(type)) {
  37.                     price += 9 * ticketsCount;
  38.                 } else if ("Popcorn".equals(type)) {
  39.                     price += 11 * ticketsCount;
  40.                 } else if ("Menu".equals(type)) {
  41.                     price += 14 * ticketsCount;
  42.                 }
  43.                 if (ticketsCount == 2) {
  44.                     price *= 0.85;
  45.                 }
  46.                 break;
  47.         }
  48.         System.out.println(String.format("Your bill is %.2f leva.", price));
  49.     }
  50. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement