Home Segments Index Top Previous Next

593: Mainline

You have learned about a program that presumes that train files contain integers that encode car types. Now suppose that the file contains serial numbers, such as the following, in which the first three characters identify the car's owner, the next character after the hyphen identifies the car's type, and the digits identify particular cars.

TPW-E-783 
PPU-B-422 
NYC-B-988 
NYC-T-988 
TPW-C-271 

You soon learn how to extract these serial numbers from a file, how to analyze them, and how to store them in class objects. Along the way, you need to learn about several subjects: