Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Create a class called student with public variables: Last name First name List of grades A class should also have member functions: Constructor: should initialize

Create a class called "student" with public variables:

  • Last name
  • First name
  • List of grades A class should also have member functions:
  • Constructor: should initialize variables - last name and first name and list of grades
  • print_student: should print first name, last name, and list of grades in a new line separated by space, and
  • calculate_avg: method should calculate an average grade.

    Example:

    Input Test_last_name Test_first_name 4 2 3.5 5 4.5 Output: Test_first_name Test_last_name Grades: 2 3.5 5 4.5 AVG grade: 3.75 
    #include "main.h"
    #include
    using namespace std;
    // Insert your's code here.
    int main(void) {
    // Do not modify main loop.
    string last, first;
    cin >> last >> first;
    int n;
    cin >> n;
    double tmp;
    vector g;
    for(int i = 0; i < n; i++){
    cin >> tmp;
    g.push_back(tmp);
    }
    student s(last, first, g);
    s.print_student();
    return 0;
    }

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started