Advertisement
zornitsa_zlateva

01. The Biscuit Factory

Oct 24th, 2021
100
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.79 KB | None | 0 0
  1. using System;
  2.  
  3. namespace _01.MidExam
  4. {
  5. class Program
  6. {
  7. static void Main(string[] args)
  8. {
  9. // int biscuitsPerWorkerPerDay = int.Parse(Console.ReadLine());
  10. double biscuitsPerWorkerPerDay = double.Parse(Console.ReadLine());
  11. double temp = biscuitsPerWorkerPerDay;
  12. int countOfWorkers = int.Parse(Console.ReadLine());
  13. int biscuitsCompetitor30Days = int.Parse(Console.ReadLine());
  14. double biscuitsPerWorkerProduced = 0;
  15.  
  16. for (int day = 1; day <= 30; day++)
  17. {
  18. int currentDay = day;
  19.  
  20. if (currentDay % 3 == 0)
  21. {
  22. biscuitsPerWorkerPerDay = 0.75 * biscuitsPerWorkerPerDay;
  23. //biscuitsPerWorkerPerDay = (int)Math.Round(0.75 * biscuitsPerWorkerPerDay);
  24. }
  25. else
  26. {
  27. biscuitsPerWorkerPerDay = temp;
  28. }
  29.  
  30. biscuitsPerWorkerProduced = biscuitsPerWorkerProduced + Math.Round(biscuitsPerWorkerPerDay);
  31. }
  32.  
  33. double totalBiscuits30Days = biscuitsPerWorkerProduced * countOfWorkers;
  34.  
  35. double differentProduction = totalBiscuits30Days - biscuitsCompetitor30Days;
  36. double percentage = Math.Abs(differentProduction / biscuitsCompetitor30Days) * 100;
  37.  
  38. Console.WriteLine($"You have produced {totalBiscuits30Days} biscuits for the past month.");
  39.  
  40. if (differentProduction > 0)
  41. {
  42. Console.WriteLine($"You produce {percentage:f2} percent more biscuits.");
  43. }
  44. else
  45. {
  46. Console.WriteLine($"You produce {percentage:f2} percent less biscuits.");
  47. }
  48. }
  49. }
  50. }
  51.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement