Advertisement
Gin10

Untitled

Feb 26th, 2020
129
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.46 KB | None | 0 0
  1. import java.util.Scanner;
  2.  
  3. public class FishingBoat_05 {
  4. public static void main(String[] args) {
  5. Scanner scanner = new Scanner(System.in);
  6. // Spring - 3000 Summer and Autumn - 4200; Winter - 2600
  7. int budget = Integer.parseInt(scanner.nextLine());
  8. String season = scanner.nextLine();
  9. int number = Integer.parseInt(scanner.nextLine());
  10. double price = 0;
  11. // <= 6 - 10% 7-11 - 15%; 12>= 25%
  12. if (season.equals("Spring")){
  13. price = 3000;
  14. }else if (season.equals("Summer") || season.equals("Autumn")){
  15. price = 4200;
  16. }else if (season.equals("Winter")){
  17. price = 2600;
  18. }
  19. double totalPrice = 0;
  20. if (number <=6){
  21. totalPrice = price * 0.9;
  22. }else if (number > 7 && number <= 11){
  23. totalPrice = price * 0.85;
  24. }else if (number >= 12){
  25. totalPrice = price * 0.75;
  26. }
  27. if (number %2 ==0){
  28. if (season.equals("Spring") || season.equals("Summer") || season.equals("Winter")){
  29. totalPrice = totalPrice * 0.95;
  30. }
  31. }
  32. if (budget >= totalPrice){
  33. double leftMoney = budget - totalPrice;
  34. System.out.printf("Yes! You have %.2f leva left.", leftMoney);
  35. }else {
  36. double needMoney = totalPrice - budget;
  37. System.out.printf("Not enough money! You need %.2f leva.", needMoney);
  38. }
  39. }
  40. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement