Homework Assignment 1 - Writing a Simple Class
Due: Wednesday, January 18 at 10 AM.
This first assignment asks you to implement a small class that is part of a larger object-oriented program. You will implement a new MemoDatabase class for the MemoPad program that we discussed in Sessions 1 and 2.
If you haven't yet, download the code file for Session 1 from the course web page. This zip file contains a directory with all of the files of the MemoPad program. To "unzip" this file, use the unzip command at your Unix or MS-DOS prompt, or double-click on the file icon.
Among the files you will find there is an implementation of the MemoDatabase interface, named DefaultMemoDatabase. You will write a new class to use in place of the DefaultMemoDatabase class.
Here are a couple of Java-specific items that might help you:
And, of course, all instance variables are private.
1. Write a class MyMemoDatabase that implements the MemoDatabase interface.
Your class should use some technique you know from your CS I course. This means that you will probably need to use an array, ArrayList, or maybe a Vector to hold your collection(s) of keys and values. I do not want you to go off to learn some new kind of data structure for your collection.
Remember that an array doesn't know how many items it contains; it knows only how many items it can hold.
Give your class a good name that reflects the job it performs.
2. Change the MemoPad class to use your database class.
Change the line in the MemoPad class that creates the database to make an instance of your class instead.
You should not modify any other class. You should not modify MemoPad in any other way. We will use your two classes with the original versions of all the other files when we test them.
By the due date and time, submit the files
Be sure that your submission follows all homework submission requirements.