Assignment 5 (revised) - CS 1711 - Fall 1999

Due: Friday, December 3, 4:30 pm (last day of classes)

If you already completed the earlier version you may submit it as gradeold.cpp.

Question

The Student class models the marks for a student in CS 1711. It is declared and implemented in the (revised) header file student.h, located in T:\comp_sci\cs1711\asst5\)

The methods of Student are as follows:

  • Student, a default constructor which initializes a student record.
  • setName   accepts a String and sets the name of the student
  • setMarks accepts an (integer) mark array containing marks for assignments, labs, midterm, and final exam.
  • grade accepts a "weight vector" (an array of reals) and returns the calculated grade (a real number) out of 100.
  • displayStudent() displays the student name,  and the calculated grade as a series of 0 to 20 *'s.
  • You will be required to insert the Student class declaration and implementation at the top of you program marks.cpp.  As well, you will need to complete the implementation of the grade() method. You must NOT modify any other portions of the Student class, and are not allowed to access any of the private information in the Student class for use in the main program.

    Data for student marks is stored in the file marks.dat, which is of the form
    20
    Smith,F    90    90    90    90
    Alward,G   40    40    40    40
    <etc>

    The first line in the file marks.dat represents the number of student records in the file. For convenience, you may assume that there are 100 or fewer student records in the file. The remainder of the lines in the file contain a student name, assignment mark, lab mark, midterm mark, and final exam mark (all out of 100). The course grade is calculated (by  the grade method) using the weighting

    Write a program which gets the information from  the file marks.dat, prompts the user for the number ("n") of students to be displayed, and which then displays the first "n" names and marks (as indicated below) If the user requests more students than are present in the file, the entire set of marks will be displayed. The output should also include a summary at the bottom of the "graphical display" which indicates the number of records processed, the maximum, minimum, and average of the records displayed, with the "graphical display" in the form of a bar chart, where the number of asterisks (*) printed represent the grade in increments of 5 (as produced by the displayStudent() method). The user should be allowed to continue to request a display of the first n records until 0 is entered.

    Sample run:

    How many students > 2

    Student Performance in CS 1711
    -----------------------------------
    Smith,F         ******************
    Alward,G        ********
    ------------------------------------
    # of students =   2
    Maximum grade =  90
    Minimum grade =  40
    Average grade =  65
    -------------------------------------

    How many students > 0
    Processing complete

    Submit the file grades.cpp to the appropriate dropbox.