Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package fishingboat;
- import java.util.Scanner;
- public class FishingBoat {
- public static void main(String[] args) {
- Scanner scanner = new Scanner(System.in);
- double groupBudget = Double.parseDouble(scanner.nextLine());
- String season = scanner.nextLine();
- int fisher = Integer.parseInt(scanner.nextLine());
- double priceRent = 0;
- if (season.equals("Spring")){
- priceRent = 3000;
- }else if (season.equals("Summer") || (season.equals("Autumn"))){
- priceRent = 4200;
- }else if (season.equals("Winter")){
- priceRent = 2600;
- }
- double discount = 0;
- if (fisher <= 6){
- discount = 0.10;
- }else if (fisher >= 7 && fisher <= 11){
- discount = 0.15;
- }else if (fisher > 12){
- discount = 0.25;
- }
- if (fisher <= 6){
- priceRent -= (priceRent * discount);
- }else if (fisher >= 7 && fisher <= 11){
- priceRent -= (priceRent * discount);
- }else if (fisher > 12){
- priceRent -= (priceRent * discount);
- }
- if ((fisher % 2 == 0) && (!season.equals("Autumn"))){
- priceRent -= (priceRent * 0.05);
- }
- double result = Math.abs(priceRent - groupBudget);
- if (priceRent > groupBudget){
- System.out.printf("Not enough money! You need %.2f leva.",result);
- }else{
- System.out.printf("Yes! You have %.2f leva left.",result);
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment