CO311: Introduction to Modern Programming II

Practice Test to prepare for Practical #7 on March 20

Please read the entire problem before jumping into the code!

Write a program that will read “recruitment” data from a file that is specified by the user. The data will be organized as follows:

There will be exactly 5 records in the file, one record per line. For example:

	Sergeant Joe Biner 566879

Each record consists of four components:

After reading all 5 records into your program, print to the screen a “roll call” showing each recruit in the following format: last name, first name (serial number) rank. Example input:

Private Tally Jones 432252
Sergeant Joe Biner 566879
Private Adam Antte 903039
Private Kelly Durbin 263093
Corporal Charles Dugan 905034

Example output:

Jones, Tally (432252) Private
Biner, Joe (566879) Sergeant
Antte, Adam (903039) Private
Durbin, Kelly (263093) Private
Dugan, Charles (905034) Corporal

Use good programming methods, including separate functions where appropriate! You can find a sample data file (recruits.txt) in the COMMON area of the FTP site under practicals/p7.