Advertisement
sivancheva

CakeTycoon

May 26th, 2017
102
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.10 KB | None | 0 0
  1. namespace _01CakeTycoon
  2. {
  3. using System;
  4.  
  5. public class CakeTycoon
  6. {
  7. public static void Main()
  8. {
  9. ulong cakesWanted = ulong.Parse(Console.ReadLine());
  10. double kilosPerCake = double.Parse(Console.ReadLine());
  11. uint flourKilos = uint.Parse(Console.ReadLine());
  12. uint truffles = uint.Parse(Console.ReadLine());
  13. uint trufflePrice = uint.Parse(Console.ReadLine());
  14.  
  15. ulong truffleCost = (ulong)truffles * trufflePrice;
  16. double cakesProduced = Math.Floor(flourKilos / kilosPerCake);
  17.  
  18. if (cakesProduced < cakesWanted)
  19. {
  20. double kilogramsNeeded = (kilosPerCake * cakesWanted) - flourKilos;
  21. Console.WriteLine("Can make only {0} cakes, need {1:F2} kg more flour", cakesProduced, kilogramsNeeded);
  22. }
  23. else
  24. {
  25. double cakeCost = ((double)truffleCost / cakesWanted) * 1.25d;
  26. Console.WriteLine("All products available, price of a cake: {0:F2}", cakeCost);
  27. }
  28. }
  29. }
  30. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement