Sample 12 Week Practicum Exam




Name:                                                                                       Alpha:



Problem 1:

(Problem #1 was the 12-week practicum from several years ago, so it is pretty involved and is intended to be a FULL practicum. Additional practice problems are provided below.)

Problem Statement:

Write a program that will produce a simplified “Quarterly Flight Hour Report.”  The data for the report comes from four files.  The first (SquadronInfo.txt) contains squadron information such as the squadron name, number of pilots and the minimum number of hours each pilot should fly during the quarter.  The remaining three files (January.txt, February.txt, March.txt) contain monthly flight hour information and are all of the exact same format.  The format of the respective files is provided below.


Sample Data Files:




Minimum Quarterly Hours: 100

Total Pilots: 10


Pilot   Hours

P1     51

P2     64

P4     32

P6     48

P7     67

P9     48

P10    53




Program Requirements:

The problem is intended to test your knowledge of functions and arrays, and builds on earlier course content such as file i/o, looping, control flow logic, etc.  You MUST use at least three functions in your program.  The first function will read the squadron information, the second function will be used to read the monthly flight hour information, and the third function will produce the report.  You can use more than three functions if you like and may find it helpful to do so when processing the data to produce the report.  The file names for the three monthly flight hour data files must be entered from the console in order to receive full credit.  Your report will display the following information as shown in the sample output:

-          squadron name

-          total hours flown for the quarter

-          high time pilot (including hours flown)

-          average flight hours per pilot

-          those pilots who did not meet the required quarterly minimums (including hours flown).

Your program must produce correct results for any set of four data files as long as the files adhere to the format described below.  Notice that every pilot doesn’t necessarily fly every month.



Sample Output (user input shown in red):


Enter flight hour data file name: January.txt
Enter flight hour data file name: February.txt
Enter flight hour data file name: March.txt
Total flight hours for the quarter: 1150
High time pilot was P7 with 167 total hours for the quarter.
Average quarterly flight hours per pilot was: 115
The following pilots flew less than the desired minimum hours for the quarter:
P3      89 hours
P6      48 hours
P8      81 hours




Solution Hint: Consider trying to code this problem up in 1 hour and 50 minutes without getting any help or even peeking at the solution.  This will give you the most benefit out of your practicum review, and might just point out areas that you need to brush up on.  Remember to break big problems down into little ones, and to compile early and often as you develop your program.




Problem 2:

Problem Statement:  An array can be used to store large integers one digit at a time.  For example, the number 2010 could be stored in a array A by setting A[0] = 2, A[1] = 0, A[2] = 1, and A[3] = 0.  However for this exercise you might find it more useful to store the integers backward, that is, A[0] = 0, A[1] = 1, A[2] = 0, and A[3] = 2.  In this exercise you will write a program that reads in two positive integers that are 20 of fewer digits in length.  You program should prompt the user for which math operation to perform, addition or subtraction.  Write two separate functions which will perform the appropriate math operations.

Your program will read in the digits as chars using the .get() function.  After they are read into the program the characters are changed to values of type int.  The digits will be stored in and array.  You might find it useful to reverse the order of the elements in the array after the array is filled with data from the keyboard.  Whether or not you reverse the order of the array is up to you.  It can be either way, and each way has its advantages and disadvantages. 

Your program will perform the appropriate math operation and by implementing the elementary school long addition and long subtraction algorithms.  The result is then stored in a an array of size 21.  Your program should be able to handle negative values as a result of the subtraction operation.

A sample run of the program

Another sample run of the program

Based on problem 5, page 221 in Absolute C++.


Problem 3:

Problem Statement:  The file, average-rain.txt, contains the average rainfall from January to December for several cities.  The file, actual-rain.txt, contains the actual rainfall from January to December for those cities.  Write a program that reads in those two data files and stores them in two 2-dimentional arrays.  Then calculate the difference between average and actual rainfall for each city for each month and display it to the screen.  In order to make it easier to read print the output to the screen with months for the vertical axis and the cities along the top of the table.

Sample output of the program