using System; using System.Collections.Generic; namespace /* TODO: your namespace goes here */ { class MyStack { private int[] stack = new int[100]; private int top = 0; public void Push(int value) { // TODO: Add a value to the stack } public int Pop() { // TODO: Get the last item and remove it from the array } public int Peek() { // TODO: Get the last item without removing it } public int Count() { // TODO: Return the number of items } public bool IsEmpty() { // TODO: Return true when empty and false otherwise. } public bool IsFull() { // TODO: Return true when full and false otherwise. } public void PrintData() { for (int i = 0; i < top; i++) { Console.Write(stack[i] + " "); } Console.WriteLine(); } } class Program { static void Main(string[] args) { MyStack stack = new MyStack(); stack.Push(1); stack.PrintData(); stack.Push(2); stack.PrintData(); stack.Push(3); stack.PrintData(); Console.WriteLine("Pop(): " + stack.Pop()); stack.PrintData(); Console.WriteLine("Pop(): " + stack.Pop()); stack.PrintData(); stack.Push(4); stack.PrintData(); Console.WriteLine("IsEmpty(): " + stack.IsEmpty()); Console.WriteLine("IsFull(): " + stack.IsFull()); /** * Expected Output * 1 * 1 2 * 1 2 3 * Pop: 3 * 1 2 * Pop: 2 * 1 * 1 4 */ } } }