Advertisement
GabrielHr00

03. Movie Destination

Feb 15th, 2025
351
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 1.78 KB | None | 0 0
  1. package examPreparation;
  2.  
  3. import java.util.Scanner;
  4.  
  5. public class MovieDestination {
  6.     public static void main(String[] args) {
  7.         Scanner scanner = new Scanner(System.in);
  8.         double budget = Double.parseDouble(scanner.nextLine());
  9.         String destination = scanner.nextLine();
  10.         String season = scanner.nextLine();
  11.         int daysCount = Integer.parseInt(scanner.nextLine());
  12.  
  13.         double pricePerShootingDay = 0.0;
  14.         switch (destination) {
  15.             case "Dubai" -> {
  16.                 if (season.equals("Winter")) {
  17.                     pricePerShootingDay = 45000;
  18.                 } else {
  19.                     pricePerShootingDay = 40000;
  20.                 }
  21.  
  22.                 pricePerShootingDay = pricePerShootingDay * 0.70;
  23.             }
  24.             case "Sofia" -> {
  25.                 if (season.equals("Winter")) {
  26.                     pricePerShootingDay = 17000;
  27.                 } else {
  28.                     pricePerShootingDay = 12500;
  29.                 }
  30.  
  31.                 pricePerShootingDay = pricePerShootingDay + (pricePerShootingDay * 0.25);
  32.                 // pricePerShootingDay = pricePerShootingDay * 1.25;
  33.             }
  34.             case "London" -> {
  35.                 if (season.equals("Winter")) {
  36.                     pricePerShootingDay = 24000;
  37.                 } else {
  38.                     pricePerShootingDay = 20250;
  39.                 }
  40.             }
  41.         }
  42.  
  43.         double finalPrice = pricePerShootingDay * daysCount;
  44.  
  45.         double diff = Math.abs(finalPrice - budget);
  46.         if (budget >= finalPrice) {
  47.             System.out.printf("The budget for the movie is enough! We have %.2f leva left!", diff);
  48.         } else {
  49.             System.out.printf("The director needs %.2f leva more!", diff);
  50.         }
  51.  
  52.  
  53.     }
  54. }
  55.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement