{br} STUCK with your assignment? {br} When is it due? {br} Get FREE assistance. Page Title: {title}{br} Page URL: {url}
+1 917 8105386 [email protected]

This assignment utilizes a class in an application that might be useful in the “real world.” It requires the sorting of, and computation with, data stored in a vector inside of a class. In this assignment, you will design an Object-Oriented program and manipulate data using a vector within the class.
You are working for a university to maintain a list of grades and some related statistics for a student.
Class and Data members:
Create a class called Student that stores a student’s grades (integers) in a vector (do not use an array). The class should have data members that store a student’s name and course for which the grades are earned.
The class should have a 2-argument constructor that receives the student’s name and course as parameters and sets the appropriate data members to these values.
Member Functions:
The class should have functions as follows:

  1. Member functions to set and get the student’s name and course variables.
  2. A member function that adds a single grade to the vector. Only positive grades are allowed. Call this function AddGrade.
  3. A member function to sort the vector in ascending order.

Feel free to use the sort function that is available in the algorithm library for sorting vectors. Here is a web page that may help:

Or, if you would prefer to write your own sort code, you may find this site to be helpful:

  1. A member function to compute the average (x̄) of the grades in the vector. The formula for calculating an average is
    x̄ = ∑xi / n
    where xi is the value of each grade and
    n is the total number of grades in the vector.
    When using a vector, you can manipulate it just like an array. For a review on how to loop over an array to calculate a sum, you may find this video to be helpful:
Our customer support team is here to answer your questions. Ask us anything!
WeCreativez WhatsApp Support
Support Supervisor