Advertisement
silvana1303

flower shop

Mar 25th, 2020
159
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. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.Threading.Tasks;
  6. namespace silvanadoc
  7. {
  8.     class silvanadoc
  9.     {
  10.         static void Main(string[] args)
  11.         {
  12.             int magnoliaCount = int.Parse(Console.ReadLine());
  13.             int hyacinthCount = int.Parse(Console.ReadLine());
  14.             int roseCount = int.Parse(Console.ReadLine());
  15.             int cactusCount = int.Parse(Console.ReadLine());
  16.             double giftPrice = double.Parse(Console.ReadLine());
  17.  
  18.             var magnoliaSum = magnoliaCount * 3.25;
  19.             var hyacinthSum = hyacinthCount * 4;
  20.             var roseSum = roseCount * 3.5;
  21.             var cactusSum = cactusCount * 8;
  22.  
  23.             var beforeTaxes = magnoliaSum + hyacinthSum + roseSum + cactusSum;
  24.             var afterTaxes = beforeTaxes * 0.95;
  25.  
  26.             if (afterTaxes >= giftPrice)
  27.             {
  28.                 Console.WriteLine($"She is left with {Math.Floor(afterTaxes - giftPrice)} leva.");
  29.             }
  30.             else
  31.             {
  32.                 Console.WriteLine($"She will have to borrow {Math.Ceiling(giftPrice - afterTaxes)} leva.");
  33.             }
  34.  
  35.         }
  36.     }
  37. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement