SHARE
TWEET

Untitled

a guest Jun 19th, 2019 71 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. import java.util.Scanner;
  2.  
  3. public class Movie_stars_2 {
  4.     public static void main(String[] args) {
  5.         Scanner scanner = new Scanner(System.in);
  6.  
  7.         double budget = Double.parseDouble(scanner.nextLine());
  8.         String input = scanner.nextLine();
  9.         double extraSalary = 0;
  10.  
  11.         while (!input.equalsIgnoreCase("ACTION")) {
  12.  
  13.             if (input.length() > 15) {
  14.                 extraSalary = budget * 0.20;
  15.                 budget -= extraSalary;
  16.             }
  17.             double salary = Double.parseDouble(scanner.nextLine());
  18.  
  19.             budget -= salary;
  20.  
  21.  
  22.             if (budget <= 0) {
  23.                 break;
  24.             }
  25.             input = scanner.nextLine();
  26.  
  27.         }
  28.         if (budget > 0) {
  29.             System.out.printf("We are left with %.2f leva.", budget);
  30.  
  31.         } else {
  32.             System.out.printf("We need %.2f leva for our actors.", Math.abs(budget));
  33.         }
  34.  
  35.  
  36.     }
  37. }
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