Difference between revisions of "In queue class definition, make use of the IsEmpty method in Show method"

From TRCCompSci - AQA Computer Science
Jump to: navigation, search
m (Hopefully fixed my failed attempt at speaking the English language)
(I did not, maybe now I have)
 
Line 1: Line 1:
If I understand this correctly it would be replace the condition within the if statement in Show, with !IsEmpty.
+
If I understand this correctly, all you need to do is replace the condition within the if statement in the Show method, with !IsEmpty.
  
 
<syntaxhighlight lang="C#">
 
<syntaxhighlight lang="C#">

Latest revision as of 14:23, 24 May 2018

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();
                }
            }