SHARE
TWEET

Untitled

a guest Jun 18th, 2019 63 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. import java.util.Scanner;
  2.  
  3. public class Problem04 {
  4.     public static void main(String[] args){
  5.        Scanner scanner = new Scanner(System.in);
  6.  
  7.        double budget = Double.parseDouble(scanner.nextLine());
  8.  
  9.        while (budget >= 0) {
  10.            String input = scanner.nextLine();
  11.            if (input.equals("ACTION")) {
  12.                break;
  13.            }
  14.            double costActor = 0;
  15.            if (input.length() > 15) {
  16.                costActor = budget * 0.2;
  17.            } else {
  18.                costActor = Double.parseDouble(scanner.nextLine());
  19.            }
  20.  
  21.            budget = budget - costActor;
  22.        }
  23.  
  24.        if (budget >= 0) {
  25.            System.out.printf("We are left with %.2f leva.", budget);
  26.        } else {
  27.            System.out.printf("We need %.2f leva for our actors.", Math.abs(budget));
  28.        }
  29.     }
  30. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top