Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.util.Scanner;
- public class O4FishingBoat {
- public static void main(String[] args) {
- Scanner scanner = new Scanner(System.in);
- int budgetGroup = Integer.parseInt(scanner.nextLine()); //Бюджет на групата
- String season = scanner.nextLine(); //"Spring" , "Summer", "Autumn", "Winter"
- int numberFished = Integer.parseInt(scanner.nextLine()); //Брой рибари
- double price = 0;
- switch (season) {
- case "Spring":
- price += 3000;
- break;
- case "Summer":
- case "Autumn":
- price += 4200;
- break;
- case "Winter":
- price += 2600;
- break;
- }
- if(numberFished <= 6)
- {
- price *= 0.90; //discount 10%
- }else if(numberFished >7 && numberFished <=11)
- {
- price *= 0.85;
- }else if(numberFished >=12)
- {
- price *=0.75;
- }
- if (numberFished % 2 == 0 && season != "Autumn") {
- price *= 0.95;
- }
- if(budgetGroup >= price)
- {
- System.out.printf("Yes! You have %.2f leva left.",Math.abs(budgetGroup-price));
- }else if(budgetGroup <= price){
- System.out.printf("Not enough money! You need %.2f leva.",Math.abs(price-budgetGroup));
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement