In queue class definition, make use of the IsEmpty method in Show method

From TRCCompSci - AQA Computer Science
Revision as of 15:23, 24 May 2018 by Jared (talk | contribs) (I did not, maybe now I have)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

If I understand this correctly, all you need to do is replace the condition within the if statement in the Show method, with !IsEmpty.

            public void Show(){
                if (!IsEmpty())//This has changed from Rear != -1
                {
                    Console.WriteLine();
                    Console.Write("The contents of the queue are: ");
                    foreach (var item in Contents)
                    {
                        Console.Write(item);
                    }
                    Console.WriteLine();
                }
            }