bacco

Магазин за цветя

Jan 31st, 2018
204
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.21 KB | None | 0 0
  1. using System;
  2.  
  3. namespace tESt
  4. {
  5.     class Program
  6.     {
  7.         static void Main(string[] args)
  8.  
  9.         {
  10.             var magnolia = int.Parse(Console.ReadLine());
  11.             var hyacinth = int.Parse(Console.ReadLine());
  12.             var rose = int.Parse(Console.ReadLine());
  13.             var cactus = int.Parse(Console.ReadLine());
  14.  
  15.             var presantPrice = int.Parse(Console.ReadLine());
  16.  
  17.             const double magnoliaPrice = 3.25;
  18.             const double hyacinthPrice = 4.00;
  19.             const double rosePrice = 3.50;
  20.             const double cactusPrice = 8.00;
  21.  
  22.             var profit = (magnolia * magnoliaPrice + hyacinth * hyacinthPrice +
  23.                 rose * rosePrice + cactus * cactusPrice) * 0.95;  // 5% taxes
  24.            
  25.             var diff = presantPrice - profit;
  26.            
  27.             if (diff > 0)
  28.             {
  29.                 diff = Math.Ceiling(diff);
  30.                 Console.WriteLine($"She is left with {diff} leva.");
  31.             }
  32.             else
  33.             {
  34.                 diff = Math.Abs(diff);
  35.                 diff = Math.Floor(diff);
  36.                 Console.WriteLine($"She will have to borrow {diff} leva.");
  37.             }
  38.         }
  39.     }
  40. }
Advertisement
Add Comment
Please, Sign In to add comment