The world’s Largest Sharp Brain Virtual Experts Marketplace Just a click Away
Levels Tought:
Elementary,Middle School,High School,College,University,PHD
| Teaching Since: | Apr 2017 |
| Last Sign in: | 103 Weeks Ago, 3 Days Ago |
| Questions Answered: | 4870 |
| Tutorials Posted: | 4863 |
MBA IT, Mater in Science and Technology
Devry
Jul-1996 - Jul-2000
Professor
Devry University
Mar-2010 - Oct-2016
Hello again. You helped me out a couple of weeks ago and would like your assistance again. Attached is the instructions for the project. Basically, I have to take a series of integers that user will input in a GUI, and insert those integers into a binary search tree, and then output the numbers in sorted manner. Also, there are two groups of radio buttons, one group is for ascending and descending order, and the other is for integers or fraction format.
Â
I have the GUI built and I have attached that code here. I'm just asking for the code, not the word document that explains the reasons for the design, test table, etc. I can do that. What I'm struggling with, is how to take the string of integers that the user inputs and then inserting them in a binary search tree. Right now I have the binary search tree accepting an integer. I tried taking the string of integers and parsing them into an int array, but I can't put that into a binary search tree because I have the parameters accepting an integer, not an array. Therefore, I will only attached the GUI class and not the other classes I made to avoid confusion.
Â
package p3gui;import java.awt.*;import java.awt.event.ActionEvent;import java.awt.event.ActionListener;import java.util.Scanner;import javax.swing.*;/*** P3GUI.java* Waylon Petty* April 22, 2017* Displays a GUI that accepts a list and sorts integers, or fractions, inascending* or descending order.*/public class P3GUI extends JFrame {private JLabel originalList;private JTextField originalSort;private JLabel sortedList;private JTextField newSort;private JPanel panel;private JButton performSort;private JRadioButton ascending;private JRadioButton descending;private ButtonGroup sort;private JRadioButton integer;private JRadioButton fraction;private ButtonGroup numType;private JPanel inputPanel, outputPanel, calculatePanel, radioPanel;private JPanel left, right;public P3GUI () {super("Binary Search Tree Sort");setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE);originalList = new JLabel("Original List");originalSort = new JTextField(20);inputPanel = new JPanel();inputPanel.add(originalList);inputPanel.add(originalSort);sortedList = new JLabel("Sorted List");newSort = new JTextField(20);newSort.setEditable(false);outputPanel = new JPanel();outputPanel.add(sortedList);outputPanel.add(newSort);panel = new JPanel();panel.setLayout(new BoxLayout(panel, BoxLayout.Y_AXIS));panel.add(inputPanel);panel.add(outputPanel);add(panel, BorderLayout.NORTH);performSort = new JButton("Perform Sort");performSort.addActionListener(new ActionListener() {public void actionPerformed(ActionEvent ae) {performSortActionPerformed(ae);}});calculatePanel = new JPanel();calculatePanel.add(performSort);add(calculatePanel, BorderLayout.CENTER);ascending = new JRadioButton("Ascending");descending = new JRadioButton("Descending");sort = new ButtonGroup();