Valantina

MovieDestination

Jun 18th, 2019
57
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 1.58 KB | None | 0 0
  1. import java.util.Scanner;
  2.  
  3. public class P03_MovieDestination {
  4.     public static void main(String[] args) {
  5.         Scanner scan = new Scanner(System.in);
  6.  
  7.         double budget = Double.parseDouble(scan.nextLine());
  8.         String destination = scan.nextLine();
  9.         String season = scan.nextLine();
  10.         int days = Integer.parseInt(scan.nextLine());
  11.  
  12.         double price = 0.0;
  13.  
  14.         switch (destination) {
  15.             case "Dubai":
  16.                 if ("Summer".equals(season)) {
  17.                     price = 40_000;
  18.                 } else if ("Winter".equals(season)) {
  19.                     price = 45_000;
  20.                 }
  21.                 price = (price * days) * 0.7;
  22.                 break;
  23.             case "Sofia":
  24.                 if ("Summer".equals(season)) {
  25.                     price = 12_500;
  26.                 } else if ("Winter".equals(season)) {
  27.                     price = 17_000;
  28.                 }
  29.                 price = (price * days) * 1.25;
  30.                 break;
  31.             case "London":
  32.                 if ("Summer".equals(season)) {
  33.                     price = 20_250;
  34.                 } else if ("Winter".equals(season)) {
  35.                     price = 24_000;
  36.                 }
  37.                 price = price * days;
  38.                 break;
  39.         }
  40.  
  41.         if (price > budget) {
  42.             System.out.println(String.format("The director needs %.2f leva more!", price - budget));
  43.         } else {
  44.             System.out.println(String.format("The budget for the movie is enough! We have %.2f leva left!", budget - price));
  45.         }
  46.     }
  47. }
Add Comment
Please, Sign In to add comment