CPSC 120 LAB 11 Back to Lab index page

Lab must be completed and reviewed by Peer Instructor Seth Peery or Instructor Shawn Brenneman no later than Mon, Nov 12, by 6pm.

You are to write a nicely documented Ada program that sets up an array of a record data type that is intended to hold the following information:
    the course department (a four character dept, ie - CPSC, MATH),
    the course number (a three digit no., ie - 120, 101),
    a name for the course (up to 40 characters),
    the number of students enrolled last semester (0 -- 40),
    the number of students who achieved a grade of C or better in the course last semester (0-40),
    the percentage of students who achieved a grade of C or better last semester (0.0-100.0).

You are to create a file that contains this information from three courses, one piece of information per line.  The program should get this information for these three courses from the file.  It will calculate the per cent of students who passed the course last semester.

The program will output the course department and number, the course description (without any additional characters), and the percent of students who passed each course.

You will use a get_line statement to input the course description and use the length of the course description string to output it so no extra characters are output.  To provide the input from a file, you should create the input file with the information as specified above.  When you execute your program, you'll need to use UNIX redirection to make the program get its input from the file.  If you created a file with name in.data, you would execute by typing lab11 < in.data at the UNIX prompt.  Output will still go to the screen.

Sample Input File, (three courses with data as in the following, you are to create the data, don't put any extra lines or headers in the input data file)

CPSC
120
Principles of Computer Science 1
40
32

Sample Output

CPSC 120 - Principles of Computer Science 1
80 % Passed

MATH 151 - Calculus and Analytic Geometry
70.5 % Passed

MGNT 101 - Introduction to Business
75.2% Passed