Advertisement
veronikaaa86

05. Journey

Jan 23rd, 2022
433
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.30 KB | None | 0 0
  1. package exerciseAdvConditionalStatements;
  2.  
  3. import java.util.Scanner;
  4.  
  5. public class P05Journey {
  6. public static void main(String[] args) {
  7. Scanner scanner = new Scanner(System.in);
  8.  
  9. double budget = Double.parseDouble(scanner.nextLine());
  10. String season = scanner.nextLine();
  11.  
  12. String destination = "";
  13. String typeNight = "";
  14. double sum = 0;
  15. if (budget <= 100) {
  16. destination = "Bulgaria";
  17. if (season.equals("summer")) {
  18. sum = budget * 0.30;
  19. typeNight = "Camp";
  20. } else if (season.equals("winter")) {
  21. sum = budget * 0.70;
  22. typeNight = "Hotel";
  23. }
  24. } else if (budget <= 1000) {
  25. destination = "Balkans";
  26. if (season.equals("summer")) {
  27. sum = budget * 0.40;
  28. typeNight = "Camp";
  29. } else if (season.equals("winter")) {
  30. sum = budget * 0.80;
  31. typeNight = "Hotel";
  32. }
  33. } else {
  34. destination = "Europe";
  35. sum = budget * 0.90;
  36. typeNight = "Hotel";
  37. }
  38.  
  39. System.out.printf("Somewhere in %s%n", destination);
  40. System.out.printf("%s - %.2f", typeNight, sum);
  41. }
  42. }
  43.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement