2020 - Option 5 is missing, it could be to remove a company

From TRCCompSci - AQA Computer Science
Revision as of 13:49, 18 December 2019 by Admin (talk | contribs) (Created page with "=ModifyCompany method in Simulation= Look for the ModifyCompany method within the Simulation class. Look for this section of the ModifyCompany method: <syntaxhighlight lang=...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

ModifyCompany method in Simulation

Look for the ModifyCompany method within the Simulation class.

Look for this section of the ModifyCompany method:

                Console.Write("Enter ID of outlet: ");
                outletIndex = Convert.ToInt32(Console.ReadLine());
                if (outletIndex > 0 && outletIndex <= companies[index].GetNumberOfOutlets())
                {
                    if (choice == "2")
                    {
                        closeCompany = companies[index].CloseOutlet(outletIndex - 1);
                        if (closeCompany)
                        {
                            Console.WriteLine("That company has now closed down as it has no outlets.");
                            companies.RemoveAt(index);
                        }
                    }
                    else
                    {
                        companies[index].ExpandOutlet(outletIndex - 1);
                    }
                }
                else
                {
                    Console.WriteLine("Invalid outlet ID.");
                }

Copy this whole section, and create a new method:

        public void RemoveComapny(int index)
        {

        }

Paste the copied code into this empty method.