Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package examPrep;
- import java.util.Scanner;
- public class P03MovieDestination {
- public static void main(String[] args) {
- Scanner scanner = new Scanner(System.in);
- double budget = Double.parseDouble(scanner.nextLine());
- String destination = scanner.nextLine();
- String season = scanner.nextLine();
- int countDays = Integer.parseInt(scanner.nextLine());
- // 2. Дестинация – текст, с възможности "Dubai", "Sofia" и "London"
- // 3. Сезон – текст, с възможности "Summer" и "Winter"
- int dailyPrice = 0;
- if (destination.equals("Dubai")) {
- if (season.equals("Summer")) {
- dailyPrice = 40000;
- } else {
- dailyPrice = 45000;
- }
- } else if (destination.equals("Sofia")) {
- if (season.equals("Summer")) {
- dailyPrice = 12500;
- } else {
- dailyPrice = 17000;
- }
- } else {
- if (season.equals("Summer")) {
- dailyPrice = 20250;
- } else {
- dailyPrice = 24000;
- }
- }
- double allDayPrice = countDays * dailyPrice;
- if (destination.equals("Dubai")) {
- allDayPrice = allDayPrice - (allDayPrice * 0.30);
- } else if (destination.equals("Sofia")) {
- allDayPrice = allDayPrice * 1.25;
- }
- double diff = Math.abs(allDayPrice - budget);
- if (allDayPrice <= budget) {
- System.out.printf("The budget for the movie is enough! We have %.2f leva left!", diff);
- } else {
- System.out.printf("The director needs %.2f leva more!", diff);
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement