Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- namespace _04.MovieStars
- {
- class MovieStars
- {
- static void Main(string[] args)
- {
- double budget = double.Parse(Console.ReadLine());
- string command = Console.ReadLine();
- bool endBudget = false;
- while (command != "ACTION")
- {
- string actor = command;
- double salary = 0;
- if (actor.Length <= 15)
- {
- salary = double.Parse(Console.ReadLine());
- }
- else
- {
- salary = budget * 0.20;
- }
- budget -= salary;
- if (budget <= 0)
- {
- Console.WriteLine($"We need {Math.Abs(budget):f2} leva for our actors.");
- endBudget = true;
- break;
- }
- command = Console.ReadLine();
- }
- if (!endBudget)
- {
- Console.WriteLine($"We are left with {budget:F2} leva.");
- }
- }
- }
- }
Add Comment
Please, Sign In to add comment