Question: 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
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
