Advertisement
Ico123

Untitled

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