Description
Write a program that provides a way for a company to store, retrieve, and add/delete/modify customer information (including id, name and phone number). You need to use a binary search tree (not a list) for this assignment (in order to receive credit). Design a menu that provides the following operations: • Display the customer roster in sorted order: Display the roster of all the customers (with id, name and phone number) in sorted order (sorted by id) • Add a customer: Add a new customer to the roster. If the id is already in the roster, print some message. • Delete a customer: Deletes a customer with a given id. If the id is not found, print some message. • Search customer by ID: Search a customer with a given id and display the name and phone number of the customer if found. If not found, print some message. • Update the information of a customer: Update a customer’s name or phone number, based on a given id. If the id is not found, print some message. • Save and Exit: Save the roster into the file (the same file as the input file) and exit. You can proceed as follows: • Design and implement the class Customer. You will store instances of this class in the customer roster. The Customer class needs to extend KeyedItem class (KeyedItem class is posted on Canvas). The id (of String type) will be the key. • Design and implement the class CustomerRoster, which represents the customer roster. The class should contain a binary search tree as a data field. This tree contains all the customers in the roster. You can use the code for binary search tree we discussed in class (also posted on Canvas). • Add methods that use a text file to save and store the tree. • Design and implement the class CustomerMIS, which includes the main method. It provides the program’s menu and take actions when user selects an option. The user should be allowed to perform multiple operations until they choose to exit. The program should read data from a text file when it begins and save data into a text file when the user quits the program. Please use assg9_CustomerRoster.txt as the input file name. The input file will have the following format: one customer per line, with id, name and phone number, separated by TAB key. (A sample input file is posted on Canvas) You will need to use the code from the textbook (posted on Canvas) that implements the binary search tree. Multiple files are needed and you may need to split some file into several files, with each file containing one class. For the code from the textbook, you do not 2 need to add additional comments. But you do need to add the package statement so that all the files will be in the same package. Submission instructions: To submit your programs, you need to submit your programs electronically on Canvas. Please use a named package for each of your assignment. For example, for assignment 9, create a new package and name your package as assg9_yourPirateId (use lower case for your pirate id), such as assg9_smithj19. You also need to include a statement such as “package assg9_smithj19;” at the beginning of each of your .java file. Please follow this naming convention exactly for all assignments. You will be deducted points for not doing so. When you submit your files to Canvas, please submit a zip file with your package folder inside the zip file. The package folder should include only .java files (make sure you include .java files, not .class files). The name of the folder should match with your package name.