Web viewTask 1: Write a Java classes to implement a stack using a link list that includes the...

download Web viewTask 1: Write a Java classes to implement a stack using a link list that includes the following members and methods. Node class that contains. Members

If you can't read please download the document

Transcript of Web viewTask 1: Write a Java classes to implement a stack using a link list that includes the...

Task 1:

Write a Java classes to implement a stack using a link list that includes the following members and methods.

1. Node class that contains

a. Members data (int), next (node)

b. A constructor to initialize members data and next

c. A method to display the data in the node

2. Stack class that contains

a. Member top (Node)

b. A constructor to initialize top to null

c. A method to check the stack is empty or not (return type is Boolean)

d. A method to push an int onto the stack

e. A method to remove the top node and returns the reference of the removed node

3. StackApp class (main() method should be in this class)

a. Using the Stack class written in part 2, write codes to convert a decimal number into a binary number.

Task 2:

Write a Java class to sort an array using the quick sort algorithm.