Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package com.company;
- import java.util.Scanner;
- public class Main {
- public static void main(String[] args) {
- Scanner scanner = new Scanner(System.in);
- int budget = Integer.parseInt(scanner.nextLine());
- String season = scanner.nextLine();
- int fishermans = Integer.parseInt(scanner.nextLine());
- double cost = 0.0;
- if (season.equals("Spring")) {
- cost = 3000.0;
- if (fishermans <= 6) {
- cost = cost * 0.9;
- } else if (fishermans <= 11) {
- cost = cost * 0.85;
- } else {
- cost = cost * 0.75;
- }
- if (fishermans % 2 == 0) {
- cost = cost * 0.95;
- }
- } else if (season.equals("Summer")) {
- cost = 4200.0;
- if (fishermans <= 6) {
- cost = cost * 0.9;
- } else if (fishermans <= 11) {
- cost = cost * 0.85;
- } else {
- cost = cost * 0.75;
- }
- if (fishermans % 2 == 0) {
- cost = cost * 0.95;
- }
- } else if (season.equals("Autumn")) {
- cost = 4200.0;
- if (fishermans <= 6) {
- cost = cost * 0.9;
- } else if (fishermans <= 11) {
- cost = cost * 0.85;
- } else {
- cost = cost * 0.75;
- }
- } else if (season.equals("Winter")) {
- cost = 2600.0;
- if (fishermans <= 6) {
- cost = cost * 0.9;
- } else if (fishermans <= 11) {
- cost = cost * 0.85;
- } else {
- cost = cost * 0.75;
- }
- if (fishermans % 2 == 0) {
- cost = cost * 0.95;
- }
- }
- if (budget >= cost) {
- System.out.printf("Yes! You have %.2f leva left.", (budget - cost));
- } else {
- System.out.printf("Not enough money! You need %.2f leva.", (cost - budget));
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment