Lab 2 Assignment: Building DBs using random file access -- COM1101 Winter 2001
Updated Saturday 23 December 2000
Professor Futrelle
College of Computer Science, Northeastern U., Boston, MA
This page explains what you are to do and turn in for this assignment.
The background and details for the lab are here.
WHAT YOU ARE TO DO AND HAND IN
- Design a simple three-field record including an integer, a float and a string.
The integer field should be 10 characters, the float 10 characters with 2 places
of precision, and the string should be 30 characters in size.
- Create three records by interactive entry or by hard-coding them into your
source code. The integer and float must exist in your program as numerical types
and be converted to the proper character output format when writing to the
database file.
- Demonstrate the storing of the three records in a file by
writing them to a file and printing out the file.
- Demonstrate the retrieval of records by allowing the user to type in a
record number, 0, 1 or 2 and having the fields printed out as labeled items,
e.g., "The integer value is: .....", etc. The integer and float fields must
be converted from the characters in the file to their numerical types when read in.
- Copy and paste the output of your program, from the preceding step,
into a comment block at the end of your source code.
Add additional comments to explain what it demonstrates.
BACK UP YOUR FILES TO TWO OR THREE SEPARATE FLOPPIES.
Always carry a number of floppy disks with you. Do all your work using files
on the hard drive. Do NOT work directly with files on your floppy. They are
only for backup. (You cannot even run a program in debug mode using a floppy;
the Debug folder won't fit.) Use your floppies only for backup. Floppies
may fail or we may not be able to read your floppy on our machine, in which
case we will ask you for another copy. BACK UP OFTEN. Back up every ten
minutes or so. If you don't back up for an hour and disaster strikes, which
it can, then you'll have to spend another hour doing your work all over again.
In the past, students have lost many hours or even days of work by not backing
up often enough or only using a single floppy that then fails to read.
You have been warned -- no excuses after reading this.
EXTRA CREDIT
There is extra credit material for this lab. It involves recording the results
of your step-by-step development and turning that material in. See the
details page.
ADDITIONAL EXTRA CREDIT
Design a more interesting database with more and different fields, e.g., add a boolean.
Populate it with a larger collection of data that you paste in from some source,
e.g., lists of items on the web. You could read in every record and search them
for some user-defined item and print out only that record. (This is very inefficient,
especially for huge databases.
Lab 3 will involve the proper and efficient way to to retrieve records.)
WHEN AND HOW TO HAND IN ASSIGNMENTS
There is a box inside 161CN, the main College of Computer Science Office, to the left
of the door, that has the course number, COM1101 Winter 2001 and my name,
Professor Futrelle. I will give you manilla envelopes for your assignments.
You must hand in the following, in the envelope, left in the box.
- A floppy disk with all your project files except the Debug folder.
Before handing in your disk, you must verify that it compiles and runs
properly on the CCS Windows NT machines under Visual C++, no matter where
you may have done your work on the lab.
- A hard copy of your source code for your .cpp files and any .h files
you produce, as well as any .txt files you produce for the extra credit
portion.
- The due date and time for this lab is Friday, January 19th at 4pm.
- IMPORTANT! If you cannot get your program to compile or to run properly,
you must still hand in whatever you have done by the due date and time,
both floppy and hardcopy.
If you do not, your grade will be greatly reduced. If you do hand in a partial
assignment by the due date and time, and the remainder within a few days,
your grade will not be reduced as much.