Advertisement
4valeri

cakeTycoon

Feb 8th, 2016
54
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.16 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. using System.Numerics;
  7.  
  8.  
  9. class cakeTycoon
  10. {
  11.     static void Main(string[] args)
  12.     {
  13.         decimal n = decimal.Parse(Console.ReadLine());
  14.         decimal c = decimal.Parse(Console.ReadLine());
  15.         decimal f = decimal.Parse(Console.ReadLine());
  16.         decimal t = decimal.Parse(Console.ReadLine());
  17.         decimal p = decimal.Parse(Console.ReadLine());
  18.  
  19.         decimal kilograms = f / c;
  20.  
  21.         if (kilograms >= n)
  22.         {
  23.             t *= p;
  24.             decimal totalPrice = (t / n) * 1.25M;
  25.  
  26.             Console.WriteLine("All products available, price of a cake: {0:f2}", totalPrice);
  27.         }
  28.  
  29.         else
  30.         {
  31.             decimal flourRequired = c * n;
  32.             decimal kilogramNeeded = flourRequired - f;
  33.             Console.WriteLine("Can make only {0} cakes, need {1:f2} kg more flour", Math.Floor(kilograms), kilogramNeeded);
  34.         }
  35.         {
  36.              
  37.         }
  38.  
  39.         //decimal totalPrice = (t / n) * (kilograms / 100M);
  40.  
  41.         //Console.WriteLine("{0:f2}", totalPrice);
  42.  
  43.     }
  44. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement