Sinu  Joseph

Sinu Joseph

  • NA
  • 136
  • 65.6k

Implement a stack class that meets the following functional

Aug 22 2013 1:16 AM
Implement a stack class that meets the following functional requirements:
a) As a user I can push an element onto the stack.
b) As a user I can pop (=remove) an element from the stack. The implemention of this method should return the element.
c) As a user I can ask for the number of elements on the stack.
d) As a user I can peek (=look) at the top element of the stack.

Notes and rules:
1) In this instance "As a user" means a developer using the class.
2) Use C# only.
3) If you don't have a development environment you can use Visual Studio Express (C# Edition) which is available for free at Microsoft's web site.
4) Important: Do not use or reference the namespaces "System.Collections" and "System.Collections.Generic" or any element contained in them.
5) Make sure that the class meets the requirements and include appropriate and sufficient unit tests.
6) Keep the code to the absolute minimum that meets the requirements.
7) Consider making your implementation as versatile as possible while staying typesafe.
8) Consider performance aspects in your implementation.
9) There are many different solutions to this task. There is no single "correct" solution. However, try to find the best solution within the given constraints.


Answers (1)