/**Every 1 kilo of sugar and 2 kilos of ginger is equal to 1 kilo of Ginger tea * Every 1 kilo of Ginger tea, 4 packs of it can be made resulting to 4 packs of Ginger tea every 1 kilo */ static void Processing(RawInput input1, RawInput input2) { bool isGoodCondition; double chanceForBadCondition; while (running) { chanceForBadCondition = rand.NextDouble(); if (chanceForBadCondition > 0 && chanceForBadCondition < 0.05) { isGoodCondition = false; } else { isGoodCondition = true; } if (input1.GetAmount() == 0 || input2.GetAmount() < 2) { running = false; } else { productConditions.Add(new Product(product.GetName(), product.GetUnit(), isGoodCondition)); input1.SetAmount(input1.GetAmount() - 1); input2.SetAmount(input2.GetAmount() - 2); prodCount += 4; } } }
static void Main(string[] args) { Console.WriteLine("Product Manufacturing Tracking System"); Console.Write("Set today's production goal: "); prodGoal = Convert.ToInt32(Console.ReadLine()); Console.WriteLine("Product: " + product.GetName()); Console.Write("Enter amount of sugar in Kilos: "); input1 = new RawInput("Sugar", Convert.ToInt32(Console.ReadLine())); Console.Write("Enter amount of Ginger in Kilos: "); input2 = new RawInput("Ginger", Convert.ToInt32(Console.ReadLine())); Console.WriteLine("\nAvailable inputs\n" + input1.GetName() + ": " + input1.GetAmount() + "\n" + input2.GetName() + ": " + input2.GetAmount()); Processing(input1, input2); Console.WriteLine("Amount of products produced: " + prodCount + " " + product.GetUnit()); Console.WriteLine("-----------------Today's Production Summary----------------------"); TodaySummary(); }