This directory gives a simple example of a program constructed from a number of Java files. The program is a student database program. The files that comprise this program are: 1) StudentDatabase1.java This is the "front end" of the program which gives the interaction with the user. 2) Table.java This is an interface file - it gives signatures of the methods that define the Abstract Data Type "Table". 3) Table1.java This is an implementation of the interface Table.java. It gives a data structure which may be used to represent a Table, plus code for the Table methods which uses this data structure. The data structure used is an array/count pair. 4) KeyObject.java This is an abstract class which defines the objects that can be stored in a Table. All that is required of these object, as defined in this class, is that they have a key, which is a string. The class defines methods which compare objects against each other and against keys. 5) Student.java This gives a type which represents student records. The type is defined as extending the type KeyObject, so we can store objects of type Student in tables defined by type Table. The constructor for type Student takes a BufferedReader as its argument. This means a new Student object can be created either by reading from a file or from the screen. The data which is read must take the form of three lines of text. The first is the name of the student, first names followed by surname. The second is the date of birth of the student given in day/month/year format with each of day, month and year represented by integers. The third line is a list of marks obtained by the student, given as integers separated by spaces. The file called "students" is given to show an example of the format. You can run this program by having these five files in your directory and compiling them by calling the Linux command: javac StudentDatabase1.java which will compile not just the file StudentDatabase1.java but also the other files it uses. You can then run it by calling the Linux command: java StudentDatabase1 The user interface for this student database program is deliberately designed to be "minimalist". This is because this is for a course on algorithms and data structures, not a course on user interface design and programming. Therefore as little as possible code is given over to the user interface in order not to distract you from the code which is more important for the course. In fact when you run the program, you will just be prompted for a command by the single character prompt: : The commands that may be entered are: 1) f The "" here means that "f" should be followed by the name of a file which is in the same directory. The file must contain text representing student records in the form described above. The data is read from the file and stored in the database. For example, if you typed f students following the : prompt, all the information from the file called "students" would be read and stored as objects in the database. 2) a The command is just the single character "a" entered on a line of its own. It causes a single student record to be read from the screen and added to the database. After the user types the "a", the program expects the rest of the text representing the student to be typed on the next three lines, in the form given above i.e. name on first line, date of birth on second line, marks on third line. 3) p The command given by the single letter "p" displays the entire database on the screen in its text format. 4) w The command given by the letter "w" followed by a file name writes the data in the database onto the file named. If no file of that name exists, it will create one, but be careful because if a file of that name already exists content will be wiped out and replaced by the new data written. 5) r The command given by the letter "r" followed by a surname will print onto the screen the record of the student with that surname which is in the database. If no student with the given surname is in the database, a message stating that will be printed. Note, for simplicity, this program makes the unrealistic assumption that there will never be any shared surnames. 6) d The command given by the letter "d" followed by a surname will delete the record of the student with the given surname from the database. A message is printed if there is no student with the given surname in the database. 7) m The command given by the letter "m" followed by a surname followed by a mark (where the mark is a single integer) will change the record of the named student to add the new mark. A message is printed if there is no student with the given surname in the database. 8) q The command given by the single letter "q" quits the system and ends execution of the program. Any other character given as a command will cause a list of the commands to be printed. Note, the program is not robust. If commands are not entered in the correct format, it is likely to come to a premature halt.