Question: In Java, I have to allow the class to be ordered while implementing the Comparable interface. For this assignment, you have three options for choosing

In Java, I have to allow the class to be ordered whileimplementing the Comparable interface. For this assignment, you have three options forIn Java, I have to allow the class to be ordered while implementing the Comparable interface.

For this assignment, you have three options for choosing the data structure. It must be a fully encapsulated array-based data structure and have methods to implement all four of the basic operations plus a method to show all Student records in sorted order. These are the options: 1. Sorted Array. The algorithms are presented in the text in pseudocode, but there is no downloadable Java code. You can download the Unsorted Optimized Array source code and use that as a start and then modify it to conform to the Sorted Array. The Sorted Array data structure maintains an internal array in sorted order, so there is no need for a separate sort before outputting the data in the showAll method. The algorithms presented use a binary search. If you choose to implement this data structure, you should implement the methods incrementally in the order presented in the text. First, fetch, then delete, then insert, and finally update. The insert method pseudocode presented in the text is not given completely. Just translating the pseudocode to Java as many students may be tempted to do will result in a method that does not work. The insert algorithm given in the text is correct for the general case, but there are other cases to be considered. For example, the first case is when the data array is empty, so no comparisons need to be made and the Student object can just be put into the structure at array index 0. 2. Unsorted-Optimized Array. The algorithms for this method are presented in the text, and there is downloadable Java source code. You can use this source code as a start but you would have to modify it. It depends on the Listing class used in the text. You would have to replace the Listing class with the Student class. Also the internal data array is maintained in unsorted order. So you would have to sort your data array prior to output in the showAll method. The java.util.Arrays.sort method is recommended for this purpose. 3. Generic Unsorted-Optimized Array. The algorithms for this method are not repeated separately in the text. There is separate downloadable Java source code. This code may be used with your Student class in a similar way that the PhoneListing class is used by the text example. The internal data array is maintained in unsorted order. So you would have to sort your data array prior to output in the showAll method. The java.util.Arrays.sort method is recommended for this purpose. No other types of data structure may be used for this assignment. After you have your student class and your data structure coded and tested, you will write a class named StudentApp that represents an application to keep track of student information. Code the application so that when launched, the user will be asked to input the maximum size of the data set, the initial number of students, and the initial data set. If you want you may use the RandomStudents class from Assignment 10 to generate your initial data set, and you won't have to type those in. Once this is complete, the user will be presented with the following menu options: Enter: 1 to insert a new student's information, 2 to fetch and output a student's information, 3 to delete a student's information, 4 to update a student's information, 5 to output all the student information in sorted order, and 6 to exit the program. This menu will be presented repeatedly until the user chooses option 6. Each of the options should call the methods that you wrote for your data structure. You should include code that provides feedback for successful completion of the operation and an appropriate error message if an operation fails. Option 1 should first use the input method of the Student class before inserting a new student into the structure. Your input method should use console input. Do not use the pop-up dialogs! Option 4 is better written to prompt for a student record, then fetch and display the existing information first, collect changes, and then call the update method of your data structure. The program should perform an unlimited number of operations until the user enters a 6 to exit the program. For this assignment, you have three options for choosing the data structure. It must be a fully encapsulated array-based data structure and have methods to implement all four of the basic operations plus a method to show all Student records in sorted order. These are the options: 1. Sorted Array. The algorithms are presented in the text in pseudocode, but there is no downloadable Java code. You can download the Unsorted Optimized Array source code and use that as a start and then modify it to conform to the Sorted Array. The Sorted Array data structure maintains an internal array in sorted order, so there is no need for a separate sort before outputting the data in the showAll method. The algorithms presented use a binary search. If you choose to implement this data structure, you should implement the methods incrementally in the order presented in the text. First, fetch, then delete, then insert, and finally update. The insert method pseudocode presented in the text is not given completely. Just translating the pseudocode to Java as many students may be tempted to do will result in a method that does not work. The insert algorithm given in the text is correct for the general case, but there are other cases to be considered. For example, the first case is when the data array is empty, so no comparisons need to be made and the Student object can just be put into the structure at array index 0. 2. Unsorted-Optimized Array. The algorithms for this method are presented in the text, and there is downloadable Java source code. You can use this source code as a start but you would have to modify it. It depends on the Listing class used in the text. You would have to replace the Listing class with the Student class. Also the internal data array is maintained in unsorted order. So you would have to sort your data array prior to output in the showAll method. The java.util.Arrays.sort method is recommended for this purpose. 3. Generic Unsorted-Optimized Array. The algorithms for this method are not repeated separately in the text. There is separate downloadable Java source code. This code may be used with your Student class in a similar way that the PhoneListing class is used by the text example. The internal data array is maintained in unsorted order. So you would have to sort your data array prior to output in the showAll method. The java.util.Arrays.sort method is recommended for this purpose. No other types of data structure may be used for this assignment. After you have your student class and your data structure coded and tested, you will write a class named StudentApp that represents an application to keep track of student information. Code the application so that when launched, the user will be asked to input the maximum size of the data set, the initial number of students, and the initial data set. If you want you may use the RandomStudents class from Assignment 10 to generate your initial data set, and you won't have to type those in. Once this is complete, the user will be presented with the following menu options: Enter: 1 to insert a new student's information, 2 to fetch and output a student's information, 3 to delete a student's information, 4 to update a student's information, 5 to output all the student information in sorted order, and 6 to exit the program. This menu will be presented repeatedly until the user chooses option 6. Each of the options should call the methods that you wrote for your data structure. You should include code that provides feedback for successful completion of the operation and an appropriate error message if an operation fails. Option 1 should first use the input method of the Student class before inserting a new student into the structure. Your input method should use console input. Do not use the pop-up dialogs! Option 4 is better written to prompt for a student record, then fetch and display the existing information first, collect changes, and then call the update method of your data structure. The program should perform an unlimited number of operations until the user enters a 6 to exit the program

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock

To address your assignment youll need to implement a Java program with a fully encapsulated arraybased data structure to manage student records Heres a stepbystep guide to get you started Step 1 Defin... View full answer

blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!