Advertisement
SvetlozarDragnev

Untitled

Apr 22nd, 2023
31
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 1.00 KB | None | 0 0
  1. import java.util.Scanner;
  2.  
  3. public class MovieStars_05 {
  4.     public static void main(String[] args) {
  5.  
  6.         Scanner sccanner = new Scanner(System.in);
  7.  
  8.         double budget = Double.parseDouble(sccanner.nextLine());
  9.         String input = sccanner.nextLine();
  10.  
  11.  
  12.         while (!input.equals("ACTION")){
  13.             String name = input;
  14.  
  15.             int length = name.length();
  16.  
  17.             if (length < 15) {
  18.                 double price = Double.parseDouble(sccanner.nextLine());
  19.                 budget -= price;
  20.             }
  21.             else {
  22.                 budget = budget - (0.20 * budget);
  23.             }
  24.             if (budget <= 0) {
  25.                 double needed = Math.abs(budget);
  26.                 System.out.printf("We need %.2f leva for our actors.", needed);
  27.                 break;
  28.             }
  29.             name = sccanner.nextLine();
  30.  
  31.         }
  32.  
  33.         if (budget > 0){
  34.             System.out.printf("We are left with %.2f leva.", budget);
  35.         }
  36.  
  37.  
  38.  
  39.     }
  40. }
  41.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement