Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.util.Scanner;
- public class FishingBootTwo {
- public static void main(String[] args) {
- Scanner scanner = new Scanner(System.in);
- int budget = Integer.parseInt(scanner.nextLine());
- String sezon = scanner.nextLine();
- int numFishman = Integer.parseInt(scanner.nextLine());
- double price = 0;
- if (sezon.equals("Spring")){
- price = 3000;
- }else if (sezon.equals("Summer") || sezon.equals ("Autumn")){
- price = 4200;
- }else if (sezon.equals("Winter")){
- price = 2600;
- }
- if (numFishman <= 6 ){
- price = price * 0.90;
- }else if (numFishman <= 7 || numFishman >= 11){
- price = price * 0.85;
- }else {
- price*= 0.75;
- }
- if (numFishman % 2 == 0 && (!sezon.equals("Autumn"))){
- price = price * 0.95;
- }
- if (budget >= price){
- double mony = budget - price;
- System.out.printf("Yes! You have %.2f leva left.",mony);
- }else {
- double monny = price - budget;
- System.out.printf("Not enough money! You need %.2f leva.",monny);
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement