Advertisement
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);
- double budget = Double.parseDouble(scanner.nextLine());
- boolean budgetIsEnough = true;
- String command = scanner.nextLine();
- while(!command.equals("ACTION")){
- String actorName = command;
- if (actorName.length() >= 15){
- budget -= (budget*0.2);
- }else {
- double salary = Double.parseDouble(scanner.nextLine());
- budget = budget-salary;
- }
- if (budget <= 0){
- budgetIsEnough = false;
- break;
- }
- command=scanner.nextLine();
- }
- if (budgetIsEnough){
- System.out.printf("We are left with %.2f leva.", budget);
- }else {
- System.out.printf("We need %.2f leva for our actors.", Math.abs(budget));
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement