A+ Answers



class Node that includes three instance variables:                 
            private  int ID;
            private double GPA;
            private Node Left;
            private Node Right;
Your class should have the following:
A constructor that initializes the two instance variablesIDandGPA.
Set and get methods for each instance variable.
toString method that returns a string containing the (student id, GPA)

class BSTree that includes:
            private Node Root;    
Your class should have the following:
public  boolean exist(int id)

private boolean exist(Node S, int id)
Will check whether a node with the same id exists in the BSTree or not.
Public  boolean insert(int  id, double gpa)

private void insert(Node R, Node S)

Insert a new node into the binary tree. If the student ID already exists  the method will return false, otherwise it will return true after inserting.
Public  boolean remove(int ID)

Remove the student with the specified ID. If the student doesn’t exist the method will return false, otherwise it will return true.
Public  void inOder()

private void inOrder(Node R)

Traverses and prints the contents of the tree in-order according to the ID. (From least to highest ID).


A test application
Display a menu to the user and asking for a choice to be entered. As follows:
The program can perform the following:
1- Insert Students
2- Remove a Student
3- Check if a Student Exists
4- Print InOrder
5- Exit
Please enter your selection:
The program will perform the action selected by the user and display a proper message when necessary.
The program will repeat these actions until the user terminates the program (Hint: Use a loop).