Advertisement
veronikaaa86

03. Movie Destination

Nov 13th, 2021
260
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.77 KB | None | 0 0
  1. package examPrep;
  2.  
  3. import java.util.Scanner;
  4.  
  5. public class P03MovieDestination {
  6. public static void main(String[] args) {
  7. Scanner scanner = new Scanner(System.in);
  8.  
  9. double budget = Double.parseDouble(scanner.nextLine());
  10. String destination = scanner.nextLine();
  11. String season = scanner.nextLine();
  12. int countDays = Integer.parseInt(scanner.nextLine());
  13.  
  14. // 2. Дестинация – текст, с възможности "Dubai", "Sofia" и "London"
  15. // 3. Сезон – текст, с възможности "Summer" и "Winter"
  16.  
  17. int dailyPrice = 0;
  18. if (destination.equals("Dubai")) {
  19. if (season.equals("Summer")) {
  20. dailyPrice = 40000;
  21. } else {
  22. dailyPrice = 45000;
  23. }
  24. } else if (destination.equals("Sofia")) {
  25. if (season.equals("Summer")) {
  26. dailyPrice = 12500;
  27. } else {
  28. dailyPrice = 17000;
  29. }
  30. } else {
  31. if (season.equals("Summer")) {
  32. dailyPrice = 20250;
  33. } else {
  34. dailyPrice = 24000;
  35. }
  36. }
  37.  
  38. double allDayPrice = countDays * dailyPrice;
  39.  
  40. if (destination.equals("Dubai")) {
  41. allDayPrice = allDayPrice - (allDayPrice * 0.30);
  42. } else if (destination.equals("Sofia")) {
  43. allDayPrice = allDayPrice * 1.25;
  44. }
  45.  
  46. double diff = Math.abs(allDayPrice - budget);
  47. if (allDayPrice <= budget) {
  48. System.out.printf("The budget for the movie is enough! We have %.2f leva left!", diff);
  49. } else {
  50. System.out.printf("The director needs %.2f leva more!", diff);
  51. }
  52. }
  53. }
  54.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement