Yachkov

BiscuitFactory

Oct 24th, 2021
80
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 2.24 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.ComponentModel.Design;
  4. using System.Data;
  5. using System.Globalization;
  6. using System.Linq;
  7. using System.Net.Http.Headers;
  8. using System.Runtime.InteropServices.ComTypes;
  9. using System.Transactions;
  10. using System.Xml.Linq;
  11.  
  12. namespace Homework
  13. {
  14.     class Program
  15.     {
  16.         static void Main()
  17.         {
  18.             double numberOfBiscuitsPerWorker = double.Parse(Console.ReadLine());
  19.             double countOfWorkers = double.Parse(Console.ReadLine());
  20.             double numberOfBiscuitsOfCompetingFactory = double.Parse(Console.ReadLine());
  21.             double totalBiscuits = 0;
  22.             double totalTotalBiscuits = 0;
  23.             double biscuitsPerThreeDays = 0;
  24.             double moreCookies = 0;
  25.             double percentage = 0;
  26.  
  27.  
  28.             for (int days = 1; days <= 30; days++)
  29.             {
  30.                 if (days % 3 == 0)
  31.                 {
  32.                     biscuitsPerThreeDays = numberOfBiscuitsPerWorker * countOfWorkers;
  33.                     biscuitsPerThreeDays *= 0.75;
  34.                     totalTotalBiscuits += biscuitsPerThreeDays;
  35.                 }
  36.                 else
  37.                 {
  38.                     totalBiscuits = numberOfBiscuitsPerWorker * countOfWorkers;
  39.                     totalTotalBiscuits += totalBiscuits;
  40.                 }
  41.             }
  42.  
  43.             if (totalTotalBiscuits == numberOfBiscuitsOfCompetingFactory)
  44.             {
  45.                 return;
  46.             }
  47.             moreCookies = totalTotalBiscuits - numberOfBiscuitsOfCompetingFactory;
  48.             percentage = moreCookies / numberOfBiscuitsOfCompetingFactory * 100;
  49.             Console.WriteLine($"You have produced {totalTotalBiscuits} biscuits for the past month.");
  50.             if (totalTotalBiscuits > numberOfBiscuitsOfCompetingFactory)
  51.             {
  52.                 Console.WriteLine($"You produce {percentage:f2} percent more biscuits. ");
  53.             }
  54.             else if (totalTotalBiscuits < numberOfBiscuitsOfCompetingFactory)
  55.             {
  56.                 Console.WriteLine($"You produce {Math.Abs(percentage):f2} percent less biscuits. ");
  57.             }
  58.             else
  59.             {
  60.                 return;
  61.             }
  62.         }
  63.     }
  64. }
  65.  
  66.  
  67.  
Advertisement
Add Comment
Please, Sign In to add comment