Advertisement
pavlinpetkov88

Flower Shop

Nov 23rd, 2016
116
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.95 KB | None | 0 0
  1. using System;
  2.  
  3. class FlowerShop
  4. {
  5.     static void Main()
  6.     {
  7.  
  8.         int mongoliaPcs = int.Parse(Console.ReadLine());
  9.         int hyacinthPcs = int.Parse(Console.ReadLine());
  10.         int rosePcs = int.Parse(Console.ReadLine());
  11.         int cactusPcs = int.Parse(Console.ReadLine());
  12.         double giftPrice = double.Parse(Console.ReadLine());
  13.  
  14.         double mongolia = 3.25 * mongoliaPcs;
  15.         double hyacinth = 4.00 * hyacinthPcs;
  16.         double rose = 3.50 * rosePcs;
  17.         double cactus = 8.00 * cactusPcs;
  18.  
  19.         double totalSum = mongolia + hyacinth + rose + cactus;
  20.         double percent = Math.Abs(totalSum - totalSum * 0.05);
  21.  
  22.         if (giftPrice >= percent)
  23.         {
  24.             Console.WriteLine("She will have to borrow {0} leva.", Math.Ceiling(giftPrice - percent));
  25.         }
  26.         else
  27.         {
  28.             Console.WriteLine("She is left with {0} leva.", Math.Truncate(percent - giftPrice));
  29.         }
  30.  
  31.     }
  32. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement