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 budjet = Integer.parseInt(scanner.nextLine());
- String season = scanner.nextLine();
- int coutFishers = Integer.parseInt(scanner.nextLine());
- double discount = 0;
- switch (season) {
- case "Spring":
- if (coutFishers <= 6) {
- discount = 3000 - (3000 * 0.1);
- if (coutFishers % 2 == 0) {
- discount = discount - (discount * 0.05);
- }
- } else if (coutFishers <= 11) {
- discount = 3000 - (3000 * 0.15);
- if (coutFishers % 2 == 0) {
- discount = discount - (discount * 0.05);
- }
- } else {
- discount = 3000 - (3000 * 0.25);
- if (coutFishers % 2 == 0) {
- discount = discount - (discount * 0.05);
- }
- }
- break;
- case "Summer":
- case "Autumn":
- if (coutFishers <= 6) {
- discount = 4200 - (4200 * 0.1);
- if ((coutFishers % 2 == 0) && ("Summer".equals(season))) {
- discount = discount - (discount * 0.05);
- }
- } else if (coutFishers <= 11) {
- discount = 4200 - (4200 * 0.15);
- if ((coutFishers % 2 == 0) && ("Summer".equals(season))) {
- discount = discount - (discount * 0.05);
- }
- } else {
- discount = 4200 - (4200 * 0.25);
- if ((coutFishers % 2 == 0) && ("Summer".equals(season))) {
- discount = discount - (discount * 0.05);
- }
- }
- break;
- case "Winter":
- if (coutFishers <= 6) {
- discount = 2600 - (2600 * 0.1);
- if (coutFishers % 2 == 0) {
- discount = discount - (discount * 0.05);
- }
- } else if (coutFishers <= 11) {
- discount = 2600 - (2600 * 0.15);
- if (coutFishers % 2 == 0) {
- discount = discount - (discount * 0.05);
- }
- } else {
- discount = 2600 - (2600 * 0.25);
- if (coutFishers % 2 == 0) {
- discount = discount - (discount * 0.05);
- }
- }
- break;
- }
- if (discount <= budjet){
- System.out.printf("Yes! You have %.2f leva left.", (budjet - discount));
- } else {
- System.out.printf("Not enough money! You need %.2f leva.", (discount - budjet));
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement