Program 2

Approaching the Store

Due: 16 October 2001

Your goal is to develop a program that will allow customers to specify an item to buy. Your program will present a CGI interface to the user that provides a sequence of item descriptions accompanied by order blocks. Each order block will contain a sequence of order elements, one for each subitem of the item. Each order element contains a quantity textfield (initially set to have value 1) and a "Buy" submit button.

Your program will initialize the specified items from an inventory file (named ``inventory'' residing in the current directory) containing a sequence of lines each containing a sequence of colon separated fields.

Two types of lines appear in the inventory file in arbitrary order:

You program will need to read the inventory file and construct a web page containing the order blocks.

When the viewer of the web page selects an item (by possibly changing the associated quantity and pressing the associated submit button) they should be directed to the same CGI application which will then specify which item was ordered (by Subitem-id) and tell what quantity was ordered.

A string sequence is a sequence of glyphs each of which is either