Advertisement
Dianov

Conditional Statements - Exercise (06. Godzilla vs. Kong)

Oct 18th, 2020
151
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.96 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.Threading.Tasks;
  6.  
  7. namespace GodzillaVsKong
  8. {
  9.     class Program
  10.     {
  11.         static void Main(string[] args)
  12.         {
  13.             double money = double.Parse(Console.ReadLine());
  14.             int statists = int.Parse(Console.ReadLine());
  15.             double clothesPriceForOne = double.Parse(Console.ReadLine());
  16.  
  17.             double decor = money * 0.10;
  18.             double discount;
  19.             double neededMoney;
  20.             if (statists > 150)
  21.             {
  22.                 discount = clothesPriceForOne * 0.10;
  23.                 neededMoney = (statists * (clothesPriceForOne - discount)) + decor;
  24.                 if (neededMoney > money)
  25.                 {
  26.                     Console.WriteLine("Not enough money!");
  27.                     double wingardNeeds = neededMoney - money;
  28.                     Console.WriteLine("Wingard needs {0:F2} leva more.", wingardNeeds);
  29.                 }
  30.                 else
  31.                 {
  32.                     Console.WriteLine("Action!");
  33.                     double leftmoney = money - neededMoney;
  34.                     Console.WriteLine("Wingard starts filming with {0:F2} leva left.", leftmoney);
  35.                 }
  36.             }
  37.             else
  38.             {
  39.                 neededMoney = (statists * clothesPriceForOne) + decor;
  40.                 if (neededMoney > money)
  41.                 {
  42.                     Console.WriteLine("Not enough money!");
  43.                     double wingardNeeds = neededMoney - money;
  44.                     Console.WriteLine("Wingard needs {0:F2} leva more.", wingardNeeds);
  45.                 }
  46.                 else
  47.                 {
  48.                     Console.WriteLine("Action!");
  49.                     double leftmoney = money - neededMoney;
  50.                     Console.WriteLine("Wingard starts filming with {0:F2} leva left.", leftmoney);
  51.                 }
  52.             }
  53.         }
  54.     }
  55. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement