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