jwrbg

asd

Jan 31st, 2019
244
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 1.38 KB | None | 0 0
  1. package ProgammingBasics;
  2.  
  3. import java.util.Scanner;
  4.  
  5. public class fishingBoat {
  6.     public static void main(String[] args){
  7.         Scanner scanner=new Scanner(System.in);
  8.  
  9.         int budget = Integer.parseInt(scanner.nextLine());
  10.         String season = scanner.nextLine();
  11.         int numOfFishers=Integer.parseInt(scanner.nextLine());
  12.  
  13.         double priceOfboat=0;
  14.  
  15.         if(season.equalsIgnoreCase("Spring")){
  16.             priceOfboat=3000;
  17.         }else if(season.equalsIgnoreCase("Summer")||(season.equalsIgnoreCase("autumn")) ){
  18.             priceOfboat=4200;
  19.         } else if(season.equalsIgnoreCase("winter")){
  20.             priceOfboat=2600;
  21.         }
  22.  
  23.         if(numOfFishers<=6){
  24.             priceOfboat=priceOfboat-(priceOfboat*0.10);
  25.  
  26.         }else if(numOfFishers>6&&numOfFishers<=11){
  27.             priceOfboat=priceOfboat-(priceOfboat*0.15);
  28.  
  29.         }else if(numOfFishers>11){
  30.             priceOfboat=priceOfboat-(priceOfboat*0.25);
  31.  
  32.         }
  33.         if(!season.equalsIgnoreCase("autumn") && numOfFishers%2==0){
  34.             priceOfboat=priceOfboat-(priceOfboat*0.05);}
  35.  
  36.         if(budget>=priceOfboat){
  37.             System.out.printf("Yes! You have"+" %.2f "+"leva left.",budget-priceOfboat);
  38.         }else{
  39.             System.out.printf("Not enough money! You need"+" %.2f "+"leva.",Math.abs(budget-priceOfboat));
  40.         }
  41.  
  42.         }
  43.  
  44.         }
Advertisement
Add Comment
Please, Sign In to add comment