Barz
Apprentice

- Joined
- May 24, 2010
- Sythe Gold
- 0
- Messages
- 753
This project builds on the code provided by the instructor following class. Your assignment is to build the Stack class as described below:
* Implement the Stack class' constructor and destructor.
* Implement the following public methods:
o void push (VALUE value);
Pushes the object specified by the value parameter onto the top of the stack.
o VALUE pop ();
Removes top value from the stack and returns it.
o VALUE top ();
Returns the top value from the stack, but does not remove it.
o Implement the following public "helper" methods:
+ int getSize()
Returns the number of elements in the array.
+ bool isEmpty()
Returns true if the list is empty. Otherwise it returns false
+ bool isFull()
Returns true if the list is full. Returns false to otherwise.
heres the format of code my teacher gave me
i might b willing to pay if someone legitmately helps me and brings me up to speed with my class
* Implement the Stack class' constructor and destructor.
* Implement the following public methods:
o void push (VALUE value);
Pushes the object specified by the value parameter onto the top of the stack.
o VALUE pop ();
Removes top value from the stack and returns it.
o VALUE top ();
Returns the top value from the stack, but does not remove it.
o Implement the following public "helper" methods:
+ int getSize()
Returns the number of elements in the array.
+ bool isEmpty()
Returns true if the list is empty. Otherwise it returns false
+ bool isFull()
Returns true if the list is full. Returns false to otherwise.
heres the format of code my teacher gave me
i might b willing to pay if someone legitmately helps me and brings me up to speed with my class
Code:
#ifndef STACK_H_
#define STACK_H_
template<class TYPE>
class Stack
{
private:
class Node
{
public:
TYPE value;
Node *next;
Node(TYPE theValue, Node *existingList)
{
value = theValue;
next = existingList;
}
};
int size;
Node *top;
public:
class StackFullException {};
class StackEmptyException {};
Stack()
{
}
TYPE pop()
{
if (!isEmpty())
{
}
else
throw new StackEmptyException();
}
void push(TYPE newValue)
{
if (!isFull())
{
}
else
throw new StackFullException();
}
TYPE getTop()
{
TYPE result;
if (!isEmpty())
{
}
else
throw new StackEmptyException();
return result;
}
int getSize()
{
}
bool isEmpty()
{
}
bool isFull()
{
}
};
#endif /* STACK_H_ */

