Write Java application to do the following: a. Declare a BSTNotebook object named nbList. b. Insert THREE
Question:
Write Java application to do the following:
a. Declare a BSTNotebook object named nbList.
b. Insert THREE (3) Notebook objects into the binary search tree.
c. Display the details of all notebooks.
d. Count and display the number of HP notebooks with price greater than
RM5,000.
e. Calculate and display the total price of all notebooks stored in the binary search
tree.
f. Display the most expensive notebook.
g. Search and display the details of a notebook based on the serial number entered
by the user.
public class Notebook
{
private String serialNo;
private String brand; // HP, Acer, Lenovo, etc.
private double price;
public String getSN() {...}
public String getBrand() {...}
public double getPrice(){...}
// definition of other methods
}
public class TreeNode
{
TreeNode left;
Notebook data;
TreeNode right;
}
public class BSTNotebook
{
TreeNode root;
public void display(){...}
public int count(){...}
public double totalPrice(){...}
public double maxPrice(){...}
public String search(String){...}
// definition of other methods
A Survey of Mathematics with Applications
ISBN: 978-0134112107
10th edition
Authors: Allen R. Angel, Christine D. Abbott, Dennis Runde