Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.util.Scanner;
- public class Problem04 {
- public static void main(String[] args){
- Scanner scanner = new Scanner(System.in);
- double budget = Double.parseDouble(scanner.nextLine());
- while (budget >= 0) {
- String input = scanner.nextLine();
- if (input.equals("ACTION")) {
- break;
- }
- double costActor = 0;
- if (input.length() > 15) {
- costActor = budget * 0.2;
- } else {
- costActor = Double.parseDouble(scanner.nextLine());
- }
- budget = budget - costActor;
- }
- if (budget >= 0) {
- 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