
This assignment requires you to write a non-verbose input-driven java

Trending nowThis is a popular solution!
Step by stepSolved in 3 steps with 2 images

Errors produced when calling 3. Find the maximum element from the BST or
4. Find the minimum element from the BST before adding elements so the program should output 0(0) instead of an error
"Exception in thread "main" java.lang.NullPointerException: Cannot read field "right" because "<local1>" is null
at BST.findMax(BST.java:109)
at BST.main(BST.java:194)"
"Exception in thread "main" java.lang.NullPointerException: Cannot read field "left" because "<local1>" is null
at BST.findMin(BST.java:118)
at BST.main(BST.java:197)"

Not compiling
javac BSTMain.java
BSTMain.java:151: error: cannot find symbol
BST bst = new BST();
^
symbol: class BST
location: class BSTMain
BSTMain.java:151: error: cannot find symbol
BST bst = new BST();
^
symbol: class BST
location: class BSTMain
2 errors
When I perform action 3 or 4 first I get an error "Exception in thread "main" java.lang.NullPointerException: Cannot read field "right" because "<local1>" is null
at BST.findMax(BST.java:109)
at BST.main(BST.java:194)"
How do you go about fixing this so, example input and output should be:
Command: echo 3 4 5 6 7 0 | java BST
Output: 0(0)0(0)
Errors produced when calling 3. Find the maximum element from the BST or
4. Find the minimum element from the BST before adding elements so the program should output 0(0) instead of an error
"Exception in thread "main" java.lang.NullPointerException: Cannot read field "right" because "<local1>" is null
at BST.findMax(BST.java:109)
at BST.main(BST.java:194)"
"Exception in thread "main" java.lang.NullPointerException: Cannot read field "left" because "<local1>" is null
at BST.findMin(BST.java:118)
at BST.main(BST.java:197)"

Not compiling
javac BSTMain.java
BSTMain.java:151: error: cannot find symbol
BST bst = new BST();
^
symbol: class BST
location: class BSTMain
BSTMain.java:151: error: cannot find symbol
BST bst = new BST();
^
symbol: class BST
location: class BSTMain
2 errors
When I perform action 3 or 4 first I get an error "Exception in thread "main" java.lang.NullPointerException: Cannot read field "right" because "<local1>" is null
at BST.findMax(BST.java:109)
at BST.main(BST.java:194)"
How do you go about fixing this so, example input and output should be:
Command: echo 3 4 5 6 7 0 | java BST
Output: 0(0)0(0)
- need help on this. Thanks in advance!arrow_forwardCompulsory Task Follow these steps: ● For this task, you are required to refactor the badly written program RPN.java. This program is a Reverse-Polish Notation calculator which uses a stack. A Reverse-Polish Notation calculator is a calculator that will calculate equations where the operator follows the operands. Therefore, instead of inputting an equation as “1 + 2”, a Reverse-Polish Notation calculator would take the following input “ 1 2 +”. A stack is a data structure in which items are added to the top of the stack and removed from the top of the stack. It is therefore known as a last-in, first-out (LIFO) data structure. Stack terminology: ○ Push — is an operation that adds an item to the top of a stack. ○ Pop — is an operation that removes an item from the top of a stack. The pseudocode for this program is: ○ Get an equation (e.g. 2 3 +) from the user as input. ○ Loop through the string value input by the user. ■ When you encounter a number (remember that numbers can include…arrow_forwardIn C++ language. Please look at the instructions and help with program. This is for intermediate not advanced. so help me understand pleasearrow_forward
- CPU Priority Scheduling-preemptive: Write a Java program to implement a priority scheduling algorithm that uses low number to represent high priority. Your program should first prompts the user to input a list of process ID, arrival time, burst time, and priority for each process to be run on the CPU. The list is terminated by 0 0 0 0 for the process ID, arrival time, burst time, and priority. The program output should draw a Gantt chart (as text) that shows the scheduling order of the processes using the Priority scheduling algorithm. Also print the turnaround time, response time, and waiting time for each process along with their average for all processes. Make sure to display very helpful messages to the user for input and output.arrow_forwardUse the started code provided with QUEUE Container Adapter methods and provide the implementation of a requested functionality outlined below. This program has to be in c++, and have to use the already started code below. Scenario: A local restaurant has hired you to develop an application that will manage customer orders. Each order will be put in the queue and will be called on a first come first served bases. Develop the menu driven application with the following menu items: Add order Next order Previous order Delete order Order Size View order list View current order Order management will be resolved by utilization of an STL-queue container’s functionalities and use of the following Queue container adapter functions: enQueue: Adds the order in the queue DeQueue: Deletes the order from the queue Peek: Returns the order that is top in the queue without removing it IsEmpty: checks do we have any orders in the queue Size: returns the number of orders that are in the queue…arrow_forwardPLEASE SEPARATE EACH SOURCE CODEarrow_forward
- Database System ConceptsComputer ScienceISBN:9780078022159Author:Abraham Silberschatz Professor, Henry F. Korth, S. SudarshanPublisher:McGraw-Hill EducationStarting Out with Python (4th Edition)Computer ScienceISBN:9780134444321Author:Tony GaddisPublisher:PEARSONDigital Fundamentals (11th Edition)Computer ScienceISBN:9780132737968Author:Thomas L. FloydPublisher:PEARSON
- C How to Program (8th Edition)Computer ScienceISBN:9780133976892Author:Paul J. Deitel, Harvey DeitelPublisher:PEARSONDatabase Systems: Design, Implementation, & Manag...Computer ScienceISBN:9781337627900Author:Carlos Coronel, Steven MorrisPublisher:Cengage LearningProgrammable Logic ControllersComputer ScienceISBN:9780073373843Author:Frank D. PetruzellaPublisher:McGraw-Hill Education





