galinyotsev123

ProgBasics04Nested-Statements-Y08journey

Jan 6th, 2019
68
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.59 KB | None | 0 0
  1. import java.util.Scanner;
  2.  
  3. public class Y08journey {
  4. public static void main(String[] args) {
  5. Scanner scanner = new Scanner(System.in);
  6.  
  7. double budget = Double.parseDouble(scanner.nextLine());
  8. String season = scanner.nextLine();
  9. double price = 0;
  10.  
  11. if ("summer".equalsIgnoreCase(season)) {
  12. if (budget <= 100) {
  13. System.out.println("Somewhere in Bulgaria");
  14. price = budget * 30 / 100;
  15. System.out.printf("Camp - %.2f", price);
  16. } else if (budget <= 1000) {
  17. System.out.println("Somewhere in Balkans");
  18. price = budget * 40 / 100;
  19. System.out.printf("Camp - %.2f", price);
  20. } else {
  21. System.out.println("Somewhere in Europe");
  22. price = budget * 90 / 100;
  23. System.out.printf("Hotel - %.2f", price);
  24. }
  25. } else if ("winter".equalsIgnoreCase(season)) {
  26. if (budget <= 100) {
  27. System.out.println("Somewhere in Bulgaria");
  28. price = budget * 70 / 100;
  29. System.out.printf("Hotel - %.2f", price);
  30. } else if (budget <= 1000) {
  31. System.out.println("Somewhere in Balkans");
  32. price = budget * 80 / 100;
  33. System.out.printf("Hotel - %.2f", price);
  34. } else {
  35. System.out.println("Somewhere in Europe");
  36. price = budget * 90 / 100;
  37. System.out.printf("Hotel - %.2f", price);
  38. }
  39. }
  40. }
  41. }
Advertisement
Add Comment
Please, Sign In to add comment