Reference no: EM13337042
Part 1: Array of Objects
Program Specification
1. Using appropriate classes and methods to implement a Java application that reads the ASCII file entries (of your chosen topic) sequentially into an array of objects. You can reuse code from the workshop exercise on arrays but do not treat as perfect. The objects should contain several separate attributes and types eg string, double, Boolean, date etc. The test file should be between 10 and 20 entries in the file. As the program reads each entry (string) it should split it into distinct data items (fields) in order to form an object and store it in the array.
2. Write a method that uses the array to output to the console the list of entries in reverse order. Each entry is displayed on a new line.
3. Write a method that uses the array to calculate and return the average of one of the numerical values.
Quality (eg layout, comments, exception handling and simplicity).
Part 2: Binary Search Tree
Program Specification
1. As before using appropriate classes and methods implement a Java application that reads the ASCII file entries into a binary search tree (BST), where each node (object) contains the objects chosen. Use a suitable field (attribute) as the key. You can reuse code from the workshop exercise on Trees but do not treat as perfect. Again, as the program reads each entry (string) it should split it into distinct data items (fields) in order to form an object and store it to the BST.
2. Write a method that uses the BST to output to the screen the list of entries in alphabetical order. Each entry is displayed on a new line.
3. Write a method to count the number of items in the BST (Note that you should do this by traversing the BST and not in any other way). The method returns an integer.
4. Write a method to search the BST to find and return the largest of some value. ** Peter to clarify key or non-key value
5. Write a method that searches the BST for a given input name and returns the corresponding numerical value. If the item is not in the list of entries then a suitable message is displayed.
Quality (e.g. layout, comments, exception handling and simplicity).