Question: In this problem, you are going to implement stack of student information boxes. Suppose a box for a student contains students name, student ID, cumulative
In this problem, you are going to implement stack of student information boxes. Suppose a box for a student contains students name, student ID, cumulative grade point average (cgpa). One student record will be placed on top of the last inserted students record. While popping out, you must pop the information box that was inserted most recently. That is, this collection of boxes can be called a stack of student information boxes. Write a Java program that will implement the stack (Using Reference /Linked List) as described above and should be able to perform following operations:
1)Push one item onto the stack. Check overflow while pushing.
2)Pop one item from the stack. Check underflow while popping.
3)Retrieve the top item. If underflow occurs, report with a message.
4)Display stack. If underflow occurs, report with a message.
5)Check whether the stack is empty.
Hint: Define a method for each operation from 1-5.
part b) Write a Java program to implement exactly the same stack as in problem 1, but this time using parallel arrays
(Note: not using reference).
Hint: Parallel arrays are collection of arrays where each array stores one type of data and collectively, data at thesame index in all arrays constitute one entity/object. Consider three arrays Name, StudentID, CGPA where Name[i], StudentID[i], CGPA[i] collectively represent i-th students information box.
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
