Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package com.company;
- import java.util.Scanner;
- 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 fishermanCount = Integer.parseInt(scanner.nextLine());
- double priceForFishing = 0;
- if (season.equals("Spring")) {
- if (fishermanCount <= 6) {
- priceForFishing = 3000 - (3000 * 0.10);
- } else if (fishermanCount <= 11) {
- priceForFishing = 3000 - (3000 * 0.15);
- } else {
- priceForFishing = 3000 - (3000 * 0.25);
- }
- }
- if (season.equals("Summer") || season.equals("Autumn")) {
- if (fishermanCount <= 6) {
- priceForFishing = 4200 - (4200 * 0.10);
- } else if (fishermanCount <= 11) {
- priceForFishing = 4200 - (4200 * 0.15);
- } else {
- priceForFishing = 4200 - (4200 * 0.25);
- }
- }
- if (season.equals("Winter")) {
- if (fishermanCount <= 6) {
- priceForFishing = 2600 - (2600 * 0.10);
- } else if (fishermanCount <= 11) {
- priceForFishing = 2600 - (2600 * 0.15);
- } else {
- priceForFishing = 2600 - (2600 * 0.25);
- }
- }
- if (fishermanCount % 2 == 0 && (!season.equals("Autumn"))) {
- priceForFishing *= 0.95;
- }
- if (budget >= priceForFishing) {
- System.out.printf("Yes! You have %.2f leva left.", budget - priceForFishing);
- }else if (priceForFishing < budget) {
- System.out.printf("Not enough money! You need %,2f leva.",priceForFishing - budget);
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement