Please read the entire problem before jumping into the code!
Using the in-class examples and practice test as a guide, modify the solution to the Practical 8 Practice Test to use a safe array to hold your data read from a file.
The following is the exact instructions from that original practice test:
CO311: Introduction to Modern Programming IIPractice Test to prepare for Practical #8 on March 27Please read the entire problem before jumping into the code! Suppose you were a desk sergeant in the Army, and your Captain noticed your work last week on the practice test. Hes got a real job for your class: he has a special project from the base Colonel that hes recruiting 100 volunteers for, but needs to keep track of how many volunteers are Privates versus the volunteers who arent. Heres your task: Write a program that will read volunteer data from any file that is specified by the Captain. The data will be organized as follows: There will be an unknown number of records in the file, one record per line. Because the Captain only wants 100 volunteers, you can assume that there will be a maximum of 100 records in the file. Here is an example record: Sergeant Joe Biner Each record consists of three components:
If your class isnt already named Private Tally Jones Sergeant Joe Biner Private Adam Antte Private Kelly Durbin Corporal Charles Dugan Example output: Jones, Tally (Private) Biner, Joe (Sergeant) Antte, Adam (Private) Durbin, Kelly (Private) Dugan, Charles (Corporal) ------------------------------ Privates: 3 Use good programming methods, including separate functions where appropriate! You can find a sample data file (volunteers.txt) in the COMMON area of the FTP site under practicals/p8. |
Your class definition, implementation and driver program should be in separate files as appropriate. Submit your copies to the FTP site in a separate folder/directory called P13.
Submissions to the FTP site that are NOT saved in the separate P13 directory will be automatically docked 10 points for failing to follow instructions.