top of page

Student Grades Utility Class Structure


This application demonstrates the use of various control structures. Both iterative structures and decision structures accept multiple numeric grade percentages from the user, calculate the average, and then make a decision about what letter grade the student earned. The program includes the following:

  • GradesUtil class structure: GradesUtil-grades: float[] -total: float -average: float #letter: char+getCount(): int +getTotal(): float +getAverage(): float +getLetter(): char

    • The constructor method will be used to:

      • accept grades (use sentinel-controlled loop) and initialize the 'Grades' array. (use either static or dynamic array)

      • calculate and set the following properties for the object:

        • total - the sum of grades entered

        • average - an average of grades

        • letter - calculated letter grade (use grading scale from course syllabus without + or - grades)



  • Accessor methods simply return the specific value, nothing more.


  • A second class - GUFormatter (GradesUtil Formatter) inherits the GradesUtil onto this class. GUFormatter +printReport(): string

    • Constructor will simply call the superclass's constructor.

    • PrintReport() will use the data within the inherited properties to generate the following report.

      • Number of grades entered

      • Grades total

      • Grade average

      • Letter grade



  • A driver class demonstrates the use of the GUFormatter class. This driver application can be static or interactive.

 
 
 

Recent Posts

See All

Comments


bottom of page