Advertisement
Guest User

Untitled

a guest
Jun 16th, 2019
75
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.84 KB | None | 0 0
  1. package com.company;
  2.  
  3. import java.util.Scanner;
  4.  
  5. public class Main {
  6.  
  7. public static void main(String[] args) {
  8. Scanner scanner = new Scanner(System.in);
  9.  
  10.  
  11. double budget = Double.parseDouble(scanner.nextLine());
  12. boolean budgetIsEnough = true;
  13. String command = scanner.nextLine();
  14.  
  15.  
  16. while(!command.equals("ACTION")){
  17. String actorName = command;
  18. if (actorName.length() >= 15){
  19. budget -= (budget*0.2);
  20. }else {
  21. double salary = Double.parseDouble(scanner.nextLine());
  22. budget = budget-salary;
  23. }
  24. if (budget <= 0){
  25. budgetIsEnough = false;
  26. break;
  27. }
  28.  
  29. command=scanner.nextLine();
  30.  
  31. }
  32.  
  33. if (budgetIsEnough){
  34. System.out.printf("We are left with %.2f leva.", budget);
  35. }else {
  36. System.out.printf("We need %.2f leva for our actors.", Math.abs(budget));
  37. }
  38. }
  39. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement