CS 1401 Assignment #6

Date Assigned: Wednesday, February 23, 2005

Due Date: Wednesday, March 2, 2005, before the beginning of your lab section.

Goals: to learn file objects and looping statements.

Points: This assignment is worth a total of 20 points. No late assignments will be accepted, but credit will be given for partially completed assignments turned in on time.

Assignment: The design of a new computer science building is stored in a file building.dat. In this file, every odd line contains the name of a professor or of a TA, and every even line contains the area (in square feet) of this person's office in the new building.

For example, for two TAs, the first four lines will be:

Elsa Tai
100
Gang Xiang
150

Your program should read the file, and print a table that describes:

For example, for the above-described file, your program should print the following:

Name:                  Space (in sq. ft):
-----------------------------------------
Elsa Tai                        100
Gang Xiang                      150
-----------------------------------------
Total:                          250
Create your own file with 8-10 lines of information, and test your program on this file.

For extra credit: programming problem 3, p. 265 of the book. Please note that you will only be given credit for the extra credit assignment if your main assignment works.

Deliverables: as announced in the labs and explained in the handouts given to you in the labs.