Question: Lab 7 : Stack Objective ( s ) Stack implementation using arrays Stack implementation using Linked List Tool ( s ) / Software Java programming

Lab 7: Stack
Objective(s)
Stack implementation using arrays
Stack implementation using Linked List
Tool(s)/Software
Java programming language with NetBeans IDE.
Description
1- Stack Implementation in Java (Using Array)
public class StackArray {
int top;
int[] Stack;
public StackArray(int capacity){
Stack = new int [capacity];
top =-1;
}
STACK BASIC FUNCTIONS:
isEmpty(): Examines whether the stack is empty or not
isFull(): Examines whether the stack is full or not
Push(int value): Add a value at the top of the stack
Top()/peek(): Return/Read the value at the top of the stack
Pop(): Remove the value from the top of the stack
Display(0: Displays all the elements in the stack
makeEmpty(): Delete all elements from stack
size(): Return the number of elements in the stack
Tasks/Assignments(s)
1- Create StackArray class in Java that implements Stack using Array and implement all the methods for the following stack operations: push, pop, top, size, isEmpty, isFull, display and makeEmpty.
In the main, create object S1 from StackArray, push some values and print the top after each push operation.
2- Create StackLinkedList class in Java that implements Stack using Singly Linked List and implement all the methods for the following stack operations: push, pop, top, size, isEmpty, display and makeEmpty.
In the main, create object S2 from StackLinkedList, pop all elements from stack S1 and push them into S2.
 Lab 7: Stack Objective(s) Stack implementation using arrays Stack implementation using

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!