Assignment 2 - Database
Suppose that you are a software developer. Some company
from your town ask you to develop a database to store information about office
equipments belonging to the company. Your first task is to design and develop a
little prototype of the database application. The
Database will be used to store and manage information about desktop computers,
laptop computers and printers at the
company. The following example shows a possible print out version from your
program when queries about a desktop, a laptop and a printer, are appeared
to it.
--------------------------------------------
DESKTOP
--------------------------------------------
name: DS1254
user: Henke Larsson
office: 342
processor: PIII 700MHz
RAM: 128Mb
--------------------------------------------
--------------------------------------------
LAPTOP
--------------------------------------------
name: LP4235
user: Lars Svensson
processor: PIV 1GHz
RAM: 256Mb
manufacture: DELL
--------------------------------------------
--------------------------------------------
PRINTER
--------------------------------------------
name: PR123
office: 123
manufacture: Hewlett Packard
model: HP LaserJet 5Si MX
--------------------------------------------
It has to be possible to show and manipulate the content of
the database via an simple text-based menu which, at least, must contains the
following operations:
- Add a new desktop, laptop or printer to the database
-
Delete a desktop, laptop or printer from the database
-
Change a desktop, laptop or printer information.
-
List the content of the database
-
Search for a desktop, laptop or printer based on its name,
search for a desktop or laptop based on its user, or search for a
printer based on office.
The following part is voluntary
- Add a functionality to the database which lets the
user to list the content of the database where desktops and laptops are
sorted by name or user, and printers are sorted by name or office.
- Add a functionality by which the user can print the
content of the database to a file. Use a format as simple as possible to save
each desktop/laptop/printer in one row. (See
for example. chap 5.4
and 16.1-16.3 in Java Direkt to
get information about
java.io
.)
You have to try to reuse as many component as possible (use
inheritance and overriding). For example you should
create a (possible abstract) base class for a common state and behaviour
for desktops, laptops and printers.
Tips 1: See the following program
(with source code here)
to get some idea about how one can read from the terminal
and write it late back to the same terminal. (Note
that you do not need to understand everything about how it works to be able to
use it in this assignment).
Tips 2: You can read about the class java.util.Vector
in chapter 19.4 in
the book to get some tips about how you can store records of database
in a table with varying size.
Clarification:
- This program has to be able to execute as an
application. It has to have either a window- or
text-based menu system.
<oopj@csd.uu.se>
Last modified: Mon Jun 23 13:45:42 MET DST 2003