CMSC 204 - binary search tree.RAR

CMSC 204 - binary search tree

Concepts tested by this program: Create a binary search tree Create generic classes from interfaces Use binary files – read/write JTable – selecting a row Your assignment is to write a program that maintains a list of courses for a college. The program must be able to search for, make insertions, deletions and edit of courses. The program must be able to edit characteristics for any course. The program will also print out a course catalog in text form, and upon exit, print out a binary version of the courses.Input1. Read Text File – If the user selects the Read Text File button, use the FileChooser to select the file. The text file will have each course’s information on six consecutive lines. The format of each line is:Line Information1 Course Name (CMSC204)2 Instructor (Alexander)3 Description (Computer Science II)4 Credits (4)5 Days (MW)6 Time (12:00 – 1:40 pm)For example, the beginning of the input file might look like this: CMSC204 Alexander Computer Science II 4 MW 1:00-2:40pm1. Read Binary File - If the user selects the Read Binary File button, use the FileChooser to select the file. In order to correctly read this file, it must be in binary format, i.e., written as a single serialized object. After Read Text or Binary File – Course data populates the table, and Print Catalog and Insert Course buttons become availableWhen selecting a row in the table – Display the Course details in the right-hand text fields and make the Delete and Edit Course buttons availableOutputWhen the “Exit” button is selected, give the user the option of writing the current data to a binary file. Output the data as a serializable binary search tree in binary format. Output in preorder format. Use the FileChooser for the user to select the file to be stored in.Data Element Create a Course class that implements the DataElementInterface which extends the Comparable and Keyable interfaces. The course name will be the key (i.e. CMSC226).Data StructuresCreate a binary search tree class BST which implements the BSTInterface. It will be a generic class that can be used with any objects which implement the DataElementInterface. Implement Serializable to allow for reading from and writing to an object stream. You may use the TreeMap class from the Java API, or implement the generic BST yourself. Data ManagerCreate a Courses class that maintains a collection of Course objects with a binary search tree. Implement the DataManagerInterface. The course name will be the key for the binary search tree. Implement Tableizeable which takes the fields of all the objects in the binary search tree and puts them into a two dimensional array of strings to populate a table. Implement Serializable to allow for reading from and writing to an object stream.Exception Handling1. Deleting or Editing a Course that is not in the binary search tree.2. Adding a course with the same key as one that exists in the binary search tree. GUI1. Insert a CoursePrompt the user for the Course name, Instructor, Description, credits, days and time. Add to the collection of course objects. If any of the information is missing, print a message.2. Delete a Course The course in the selected row of the table is deleted. The table no longer displays this course. If the user has not put in the Course name or selected a row, print the following message:
Powered by