Must be written in C++ in Visual studios community In this lab, you will modify the Student...

60.1K

Verified Solution

Question

Programming

Must be written in C++ in Visualstudios community

In this lab, you will modify the Student class you created in aprevious lab. You will modify one new data member which will be astatic integer data member. Call that data member count. You alsoadd a static method to the Student class that will display thevalue of count with a message indicating what the value represents,meaning I do not want to just see a value printed to thescreen.

Change main so that it calls this new method towards the end ofthe program. Call the method using the static syntax; do not useone of the instances of the Student class.

You will also need to change the Student constructor so that itincrements the new data member you added, count.

Explain why you get the value it displays. Use codesbelow.

FIRST CODE

#include

#include \"Student.h\"

using namespace std;

int main()

{

Student rich(2);

rich.DisplayStudent();

Student mary(3);

mary.DisplayStudent();

return 0;

}

SECOND CODE

#include \"Student.h\"

Student::Student(int numGrades)

{

quanity = numGrades;

grades = new int[numGrades];

name = \"rich\";

grades[0] = 88;

grades[1] = 96;

}

Student::~Student()

{

delete[] grades;

}

void Student::DisplayStudent()

{

cout << \"Grades for \" << name << endl;

for (int index = 0; index < quanity; index++)

{

cout << *(grades + index) << endl;

}

}

THIRD CODE

#pragma once

#include

#include

using namespace std;

class Student

{

public:

Student(int numGrades);

~Student();

void DisplayStudent();

private:

string name;

int* grades;

int quanity;

};

Answer & Explanation Solved by verified expert
4.0 Ratings (612 Votes)
Here is the C code to the given questionAll the three parts of the code is providedOutput    See Answer
Get Answers to Unlimited Questions

Join us to gain access to millions of questions and expert answers. Enjoy exclusive benefits tailored just for you!

Membership Benefits:
  • Unlimited Question Access with detailed Answers
  • Zin AI - 3 Million Words
  • 10 Dall-E 3 Images
  • 20 Plot Generations
  • Conversation with Dialogue Memory
  • No Ads, Ever!
  • Access to Our Best AI Platform: Flex AI - Your personal assistant for all your inquiries!
Become a Member

Other questions asked by students