aggressiveviking

Untitled

Feb 25th, 2020
91
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.19 KB | None | 0 0
  1. using System;
  2.  
  3. namespace _04.MovieStars
  4. {
  5.     class MovieStars
  6.     {
  7.         static void Main(string[] args)
  8.         {
  9.             double budget = double.Parse(Console.ReadLine());
  10.             string command = Console.ReadLine();
  11.  
  12.             bool endBudget = false;
  13.            
  14.             while (command != "ACTION")
  15.             {
  16.                 string actor = command;
  17.                 double salary = 0;
  18.                
  19.                 if (actor.Length <= 15)
  20.                 {
  21.                     salary = double.Parse(Console.ReadLine());
  22.                 }
  23.                 else
  24.                 {
  25.                     salary = budget * 0.20;
  26.                 }
  27.                
  28.                 budget -= salary;
  29.                
  30.                 if (budget <= 0)
  31.                 {
  32.                     Console.WriteLine($"We need {Math.Abs(budget):f2} leva for our actors.");
  33.                     endBudget = true;
  34.                     break;
  35.                 }
  36.  
  37.                 command = Console.ReadLine();
  38.             }
  39.  
  40.             if (!endBudget)
  41.             {
  42.                 Console.WriteLine($"We are left with {budget:F2} leva.");
  43.             }
  44.         }
  45.     }
  46. }
Add Comment
Please, Sign In to add comment