Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Write a database manager that can store and work with a table of strings. It could be used to store a class list. Your
Write a "database manager" that can store and work with a table of strings. It could be used to store a class list. Your program should consist of two classes: Database class. This class should store the array (table) as a field and provide the following methods: " " " Database(int size) - A one-argument constructor which accepts the size of the table (array). It should use this size to allocate (create) the array add(int index, String value) - Set the value of the array entry at the specified index. print() - Print the contents of the array sort() - Sort the contents of the array in ascending numerical order (Hint: use the Arrays class) find(String value) - Search for a particular string in the array. If it is found print out "Entry found", otherwise print out "Not found". The Database class should not have a main() method (cont'd next page) Review Ex 12: Simple Database (cont'd) DatabaseTester class. This class uses and tests your Database class. It should contain just a main method which does the following: 1. Create a Database object of size 10. Instead of the actual number 10 you should use a constant (final) field. 2. Prompt the user to enter strings (lines of text) to add to the table. Input 10 strings and add them using the 'add' method of the Database class. 3. Print out the resulting table using the Database 'print' method. 4. Sort the database by calling the the 'sort' method. 5. Print the table again to show the sorted strings. 6. Display whether the database contains your name using the 'find' method. Don't use static' except for the main() method declaration and final fields
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started