Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

In this assignment, the goal is to exercise Linked List implementation in a GUI as a JavaFX Application. First you are going to implement a

In this assignment, the goal is to exercise Linked List implementation in a GUI as a JavaFX Application.

image text in transcribed image text in transcribed

First you are going to implement a Generic linked-list. You can specify the type as "T extends Number". This class must have minimum following member methods: constructor, insertItem, printList, and clearList.

insertItem: insert data to the list in the ascending order

printList : prints the list starting from the head

clearList : Assigns all items in the list to null,

In the GUI, there will be 5 numbered buttons, which represent the data to be inserted into the list.

When a numbered button is clicked:

its data will be inserted into mList,

the numbered button will be disabled,

the information field will be updated using mList.printList()

When Reset button is clicked:

all numbered buttons will be enabled

mList will be cleared

The information field will be updated using mList.printList()

When Close button is clicked:

The application will be closed.

Here is my code of my linked list i just need to add GUI JavaFX application to it

MAIN.java

mport java.util.Random;

public class Assignment_7 { public static Node computeTheMergeNode(LinkedList lst1, LinkedList lst2){ Node head1 = lst1.mHead; Node head2 = lst2.mHead; int l1 = lst1.count(); int l2 = lst2.count(); int diff = 0; if(l1 > l2){ diff = l1 - l2; while(diff != 0){ head1 = head1.mNext; diff--; } } else if (l2 > l1){ diff = l2 -l1; while(diff != 0){ head2 = head2.mNext; diff--; } } while(head1 != null && head2 != null){ if(head1.mNext == head2.mNext){ return head1; } head1 = head1.mNext; head2 = head2.mNext; } return (null); } /** * @param args the command line arguments */ public static void main(String[] args) { // TODO code application logic here Random random = new Random(); int szList1UntilMerge = random.nextInt(100) ; int szList2UntilMerge = random.nextInt(100) ; int szListAfterMerge = random.nextInt(100) ; LinkedList list1 = new LinkedList(); LinkedList list2 = new LinkedList(); for (int i=0;i

LinkedList.java

public class LinkedList { Node mHead; public LinkedList(){ mHead = null; } public Node insert(int value){ Node temp = new Node(value); if(mHead == null || mHead.mValue >= temp.mValue){ temp.mNext = mHead; mHead = temp; } else{ Node current = mHead; while(current.mNext != null && current.mNext.mValue

node.java

public class Node { int mValue; Node mNext; public Node(int value){ mValue = value; } public void print(){ System.out.println(mValue + ""); } }

2 3 4 5 mHead -> Reset Close

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

1 2 3 Data Base Techniques

Authors: Dick Andersen

1st Edition

0880223464, 978-0880223461

More Books

Students also viewed these Databases questions

Question

=+ Who do you think is right? Why?

Answered: 1 week ago