Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.util.Scanner;
- public class MovieStars_05 {
- public static void main(String[] args) {
- Scanner sccanner = new Scanner(System.in);
- double budget = Double.parseDouble(sccanner.nextLine());
- String input = sccanner.nextLine();
- while (!input.equals("ACTION")){
- String name = input;
- int length = name.length();
- if (length < 15) {
- double price = Double.parseDouble(sccanner.nextLine());
- budget -= price;
- }
- else {
- budget = budget - (0.20 * budget);
- }
- if (budget <= 0) {
- double needed = Math.abs(budget);
- System.out.printf("We need %.2f leva for our actors.", needed);
- break;
- }
- name = sccanner.nextLine();
- }
- if (budget > 0){
- System.out.printf("We are left with %.2f leva.", budget);
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement