Homework 0, Sample Homework.
Short Description:
Write a program that will produce paper order forms for a small company
This assignment is worth 0 points.
Goals
When you finish this homework, you should have:
- Observed the design and implementation process for a program.
Formal Description
You have been hired by a company to create an order form system. More specifically, someone has set up a primitive web ordering page. They were capable of simple html, and managed to store information in several files. As the owner of the company didn't think the web interface was important, they were happy to process orders by hand. Fortunately for the owner, web sales have taken off. Unfortunately this has overwhelmed their process and they need some automation.
The program deals with multiple files. The first file, orders.data contains the names of the files containing the actual orders. The data is stored one order per line in the form transXXX. In this case XXX is a three digit number. This means that there will be a file, transXXX.order in the current directory containing an order. There are potentially many orders per day so there are potentially many lines in the file.
Unfortunately, sometimes an order is not completed. The customer backs out at the last minute. Since the web programmer was not the most skilled, this means that there will be a line in the orders.data file that does not have a corresponding order file. When this occurs, simply print to the screen Order transXXX is missing. where XXX is the actual order number.
Each order file consists of the following lines of data
- The customer's first name
- The customer's last name
- The first line of the customer's address
- The second line of the customer's address, if needed. This line may be blank.
- A line containing the customers state:city:zip separated by colons.
- At least one, but probably many order lines. These lines contain
- The item number, a string without spaces
- The quantity of the item ordered, a positive integer
- The weight of one of these items, a float.
- The size (S,M,L) of one of these items (a character)
For each order you should produce a file orderXXX.txt, where XXX is the order number. The lines in this file should be 80 characters wide. The file contain
PACKING SLIP
First Name LAST NAME
ADDRESS 1
ADDRESS 2 (see note)
city, state, zip
LINE ITEM NUMBER QUANTITY TOTAL WEIGHT VOLUME
1 123456 2 10.0 S
Total Items: n
Total Weight: nnnnn.n
Total Volume: S: nnn, M: nnn, L: nnn
Notes
- The words PACKING SLIP should be centered on the page.
- The address should be right justified
- If the second address line is blank, skip it. Do not print a blank line
- There is one blank line between the address and the column labels.
- The labels start at
- LINE, column 0
- ITEM NUMBER, column 10
- QUANTITY, column 30
- TOTAL WEIGHT, column 40
- VOLUME, column 60
- The line numbers should start at 1 and increase sequentially for each item.
- Print one blank line between the items and the total area.
- Print the total weight for each item rounded to 1 decimal place.
- The values will fit in the provided columns
- For totals:
- If the total is 0, print a 0
- Print the grand total weight rounded to one decimal place.
Example files:
Other Requirements
Required Files
A single tar file containing the source code and makefile for this program.
Submission
Email your tar file as an attachment to dbennett@edinboro.edu. Make sure that the title indicates that this is homework0 and that your name and section are included in the body of the message.