Exercise 1: Write the definition of a class representing a student record:

The student record class should have member variables for all the grading components, namely:

  • 2 quiz scores, graded on the basis of 10 points, weighted at 25%
  • 1 midterm exam, graded on the basis of 100 points, weighted at 25%
  • 1 final exam, graded on the basis of 100 points, weighted at 50%
  • the students weighted average numeric score

Make all member variables private.

(note that at this point, you dont have to worry about assigning values to the member variables you are just declaring them, creating placeholders for future objects of this class; you need, however, to make appropriate decisions regarding the data type of each variable)

Include member functions for each of the following:

  • Member functions to set each of the member variables to values given as arguments to the function, i.e., the mutators
  • Member functions to retrieve the data from each of the member variables, i.e., the accessors
  • A default constructor that gives default values to the objects of the class when initializing them.
  • A void function, i.e., a function that has no return value, that calculates the students weighted average numeric score for the entire course and sets the corresponding member variable

Exercise 2: Define a class for a type called CounterType. An object of this type is used to count things, so it records a count that is a nonnegative whole number. Include the member variable(s) you think are appropriate for this class. Also, include the following member functions:

  • a default constructor that sets the counter to zero
  • a constructor with one argument that sets the counter to the value specified by its argument
  • a function used to increase the count by one
  • a function used to decrease the count by one
  • a function that returns (get function) the current count value
  • a function for that outputs the count to a stream. This output function should have one formal parameter of type ostream for the output stream that receives the output (note that this can be cout or an output file).

Be sure that no member functions allow the value of the counter to become negative (Provide appropriate messaging in case the value becomes zero).

Embed your class definition in a test program.

Academic Honesty!
It is not our intention to break the school's academic policy. Posted solutions are meant to be used as a reference and should not be submitted as is. We are not held liable for any misuse of the solutions. Please see the frequently asked questions page for further questions and inquiries.
Kindly complete the form. Please provide a valid email address and we will get back to you within 24 hours. Payment is through PayPal, Buy me a Coffee or Cryptocurrency. We are a nonprofit organization however we need funds to keep this organization operating and to be able to complete our research and development projects.