CS202 Computer Science II
FAQ Newsboard  Telnet Email TA Lectures Assignments Man pages Help

Assignment 6
Due Nov 20 before class


Last modified 11/7/98 @ 8:00 a.m.

This assignment gets you familiar with linked lists, dynamic allocation, and de-alloction, and interactive input. Many applications in the real world are similar to the problem outlined below. Reservation systems, inventory systems, and many ATM systems are realizations of this same problem. The main difference: instead of dealing with databases and complicated input information, I am only asking you to deal with integers. Good luck

Design and implement a program that reads integers from an input file, sorts them in ascending order, and stores them in a linked list. Your program will have two command line arguments: the number of integers in the input file, and the name of an input file.

After reading the required number of inputs from the input file, your program should then read pairs of inputs from standard input until the end of file (the user types <ctrl> D). At this point the program should print the integers stored in the linked list on the screen and exit.

Each input pair (read from stdin) consists of a character and an integer. Only 'i', 'p', and 'd' are legal characters.

In general, typing in: Any characters other than i, p, and d causes an exit from the program. You must also ensure that the linked list remains sorted at all times.

As usual there are some constraints:

  1. You are not allowed to make any assumptions about the number of integers that you will read and manipulate. This means that you MUST use dynamic memory allocation and de-allocation.

  2. You must specify and implement an appropriate linked list class.

  3. Your program stops when it sees an EOF, end-of-file.
I have only constrained your program a little. You will be graded on program design, robustness, generality, documentation, testing, and conformance to specifications. Please design tests that show your program's strengths and weaknesses -- you will be graded on how you test your program. I will not provide sample inputs and sample outputs this time.

In the real world, you seldom get much in the way of sample inputs and outputs. Pretend that you have been given these program specifications and constraints by a client of the firm you work for. So far I have made most of the design, robustness, generality, and testing decisions for you. This time, you decide. If you have questions, try following the spirit of the code and assignment solutions that I have provided throughout the course to obtain an answer. I suggest, even encourage, you to ask me questions (email is good), I may or may not give you the answer but will give you some help. Software design in the real world is a morass of deadlines, incorrect specifications, confused clients, and limited resources. Welcome!