Advertisement
Guest User

C#

a guest
Nov 17th, 2019
861
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 ConsoleApp17
  4. {
  5.     class Program
  6.     {
  7.         static void Main(string[] args)
  8.         {
  9.             double budgetActors = double.Parse(Console.ReadLine());
  10.             string nameOfActor = string.Empty;
  11.             double salaryOut = 0;
  12.  
  13.  
  14.  
  15.             while ((nameOfActor = Console.ReadLine()) != "ACTION")
  16.             {
  17.                 if (nameOfActor.Length > 15)
  18.                 {
  19.                     salaryOut = budgetActors * 0.20;
  20.                    
  21.                 }
  22.                 else
  23.                 {
  24.                     double salary = double.Parse(Console.ReadLine());
  25.                     salaryOut = salary;
  26.                 }
  27.                
  28.                
  29.                
  30.            
  31.                 if (budgetActors < salaryOut)
  32.                 {
  33.                     Console.WriteLine($"We need {(salaryOut - budgetActors):f2} leva for our actors.");
  34.                     break;
  35.                 }
  36.                 budgetActors -= salaryOut;
  37.  
  38.             }
  39.             if (budgetActors >= salaryOut)
  40.             {
  41.                 Console.WriteLine($"We are left with {budgetActors:f2} leva.");
  42.             }
  43.         }
  44.     }
  45. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement