static void Main(string[] args) { //instantiate the bees Bee b1 = new Bee("John", 3.2F); Bee b2 = new Bee("Paul", 2.7F); Bee b3 = new Bee("Ringo", 1.1F); Bee b4 = new Bee("George", 2.0F); Bee b5 = new Bee("Kurt", 2.3F); Bee b6 = new Bee("Dave", 7.4F); Bee b7 = new Bee("Krist", 1.5F); //instantiate the beehive Beehive h1 = new Beehive(4, 1); Beehive h2 = new Beehive(3, 2); //add bees to list -Create beehives (with bees) h1.AddBee(b1); h1.AddBee(b2); h1.AddBee(b3); h1.AddBee(b4); h2.AddBee(b5); h2.AddBee(b6); h2.AddBee(b7); //collect honey calculate-From each beehive run the CollectHoney method for a specified number of days h1.CollectHoney(7); h2.CollectHoney(8); //count bee -Report on the number of bees in each beehive h1.CountBee(); h2.CountBee(); Console.ReadKey(); }
static void Main(string[] args) { Bee b1 = new Bee("John", 3.2); Bee b2 = new Bee("Paul", 2.7); Bee b3 = new Bee("George", 1.1); Bee b4 = new Bee("Ringo", 2.0); Bee b5 = new Bee("Kurt", 2.3); Bee b6 = new Bee("Dave", 7.4); Bee b7 = new Bee("Krist", 1.5); List <Bee> beeList1 = new List <Bee>(); beeList1.Add(b1); beeList1.Add(b2); beeList1.Add(b3); beeList1.Add(b4); List <Bee> beeList2 = new List <Bee>(); beeList2.Add(b5); beeList2.Add(b6); beeList2.Add(b7); Hive h1 = new Hive(beeList1, 4); Hive h2 = new Hive(beeList2, 3); Console.WriteLine("Collecting last 4 days honey from Hive 1:"); Console.WriteLine(h1.Honey(h1.Bees, 4)); Console.WriteLine("Collecting last 4 days of honey from Hive 2:"); Console.WriteLine(h2.Honey(h2.Bees, 4)); }
//Add Bees Method public void AddBee2Behive(Bee NewBee) { if (Bees.Count > this.MaxAmountBees) { System.Console.WriteLine("Sorry maximum number reached!!!"); } else { this.Bees.Add(NewBee); } }
static void Main(string[] args) { /* creating first beehive, creating 4 bees, placing them and displaying them*/ BeeHive BeeHive1 = new BeeHive(); Bee Bee11 = new Bee("John", 3.2f); Bee Bee12 = new Bee("Paul", 2.7f); Bee Bee13 = new Bee("George", 1.1f); Bee Bee14 = new Bee("Ringo", 2.0f); BeeHive1.PlaceBees(Bee11); BeeHive1.PlaceBees(Bee12); BeeHive1.PlaceBees(Bee13); BeeHive1.PlaceBees(Bee14); Console.WriteLine("First beehive: "); BeeHive1.NumBees(); Console.WriteLine(Bee11.name + ", " + Bee12.name + ", " + Bee13.name + " and " + Bee14.name); Console.WriteLine(); /* creating second beehive, creating 3 bees, placing them and displaying them*/ BeeHive BeeHive2 = new BeeHive(); Bee Bee21 = new Bee("Kurt", 2.3f); Bee Bee22 = new Bee("Dave", 7.4f); Bee Bee23 = new Bee("Krist", 1.5f); BeeHive2.PlaceBees(Bee21); BeeHive2.PlaceBees(Bee22); BeeHive2.PlaceBees(Bee23); Console.WriteLine("Second beehive: "); BeeHive2.NumBees(); Console.WriteLine(Bee21.name + ", " + Bee22.name + " and " + Bee23.name); Console.WriteLine(); /* getting user input for CollectHoney() */ Console.WriteLine("How many days do you want to collect honey for?"); int days = Convert.ToInt32(Console.ReadLine()); Console.WriteLine(); BeeHive1.CollectHoney(days); BeeHive2.CollectHoney(days); }
static void Main(string[] args) { //instantiating Bees object (Creating Bees) Bee b1 = new Bee("John", 3.2F); Bee b2 = new Bee("Paul", 2.7F); Bee b3 = new Bee("George", 1.1F); Bee b4 = new Bee("Ringo", 2.0F); Bee b5 = new Bee("Kurt", 2.3F); Bee b6 = new Bee("Dave", 7.4F); Bee b7 = new Bee("Krist", 1.5F); //instantiating Behives Beehive bh1 = new Beehive(); bh1.AddBee2Behive(b1); bh1.AddBee2Behive(b2); bh1.AddBee2Behive(b3); bh1.AddBee2Behive(b4); Beehive bh2 = new Beehive(); bh2.AddBee2Behive(b5); bh2.AddBee2Behive(b6); bh2.AddBee2Behive(b7); // Collect Honey per behive //Behive # 1 System.Console.WriteLine("***********************************"); bh1.NumberOfBumblebees(); System.Console.WriteLine("------------------------------------"); bh1.CollectHoney(100); System.Console.WriteLine("***********************************\n"); //Behive # 2 bh2.NumberOfBumblebees(); System.Console.WriteLine("------------------------------------"); bh2.CollectHoney(100); System.Console.WriteLine("***********************************"); }
public static void Main(string[] args) { Bee bee1 = new Bee(3.2f, "John"); Bee bee2 = new Bee(2.7f, "Paul"); Bee bee3 = new Bee(1.1f, "George"); Bee bee4 = new Bee(2.0f, "Ringo"); Bee bee5 = new Bee(2.3f, "Kurt"); Bee bee6 = new Bee(7.4f, "Dave"); Bee bee7 = new Bee(1.5f, "Krist"); Beehive hive = new Beehive(new List <Bee>(), 4); Beehive hive2 = new Beehive(new List <Bee>(), 3); Console.WriteLine("----------------------"); Console.WriteLine(" Beehive 01"); Console.WriteLine("----------------------"); Console.WriteLine("Beatles"); Console.WriteLine(); hive.Bees.Add(bee1); hive.Bees.Add(bee2); hive.Bees.Add(bee3); hive.Bees.Add(bee4); hive.CollectHoney(1); Console.WriteLine("----------------------"); Console.WriteLine(" Beehive 02"); Console.WriteLine("----------------------"); Console.WriteLine("Nirvana"); Console.WriteLine(); hive2.Bees.Add(bee5); hive2.Bees.Add(bee6); hive2.Bees.Add(bee7); hive2.CollectHoney(4); Console.WriteLine("----------------------"); Console.WriteLine(); Console.ReadKey(); }
// methods // add bee function public void AddBee(Bee newBee) { this.BeeList.Add(newBee); }
/* used to place bees in beehives */ public void PlaceBees(Bee Bee) { BeeList.Add(Bee); }