Advertisement
bokoto83

Christmas Market

Jul 21st, 2019
105
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.29 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 Christmas_Market
  8. {
  9.     class Program
  10.     {
  11.         static void Main(string[] args)
  12.         {
  13.  
  14.             double fantasy = 14.90;
  15.             double horror = 9.80;
  16.             double romantic = 4.30;
  17.             double salary = 0;
  18.             double neededMoney = double.Parse(Console.ReadLine());
  19.             int numberFantasy = int.Parse(Console.ReadLine());
  20.             int numberHorror = int.Parse(Console.ReadLine());
  21.             int numberRomantic = int.Parse(Console.ReadLine());
  22.  
  23.             double sum = fantasy * numberFantasy + horror * numberHorror + romantic * numberRomantic;
  24.             sum -= sum * 0.20; //  dds
  25.  
  26.             if (sum>= neededMoney)
  27.             {
  28.  
  29.                 salary = sum - neededMoney;
  30.               double totalsalary = Math.Floor( salary * 0.10);
  31.                 totalsalary = (int)totalsalary;
  32.                 sum -= totalsalary;
  33.  
  34.                 Console.WriteLine($"{sum:f2} leva donated.");
  35.                 Console.WriteLine($"Sellers will receive {totalsalary} leva.");
  36.             }
  37.             else
  38.             {
  39.                 neededMoney -= sum;
  40.                 Console.WriteLine($"{neededMoney} money needed.");
  41.             }
  42.  
  43.  
  44.  
  45.  
  46.         }
  47.     }
  48. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement