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