Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

IN C++ write a program that will make a class titled Undergraduate that the foll

ID: 3849922 • Letter: I

Question

IN C++ write a program that will make a class titled Undergraduate that the following private member variables:

(string) name - A string that stores the name of the undergradate

(int) numCourses - An integer that tracks how many courses the undergraduate is currently enrolled in

(string*) courseList - A dynamic array of strings used to store the names of the courses that undergraduate is enrolled in

(double*) gradeList - A dynamic array of double used to store the grade for each courses that the undergraduate is enrolled in

(int) numundergraduates - A static member variable that counts the number of undergraduates created

For member functions, you should have

Default constructor and argument constructor - public constructors to initialize and create an object from class

undergraduate( )

undergraduate(string name, int numCourses)

undergraduate(const undergraduate& others)

Appropriate and necessary mutators and accessors for private members (what to be defined would depend on specific purpose in your task )

A public function that prints the undergraduates name, all courses in courseList and all grades in gradeList

A public function that calculates and print this undergraduates GPA

A function that resets the numCourses to 0 and the courseList and gradeList to an empty list

A destructor that releases all memory that has been allocated

1.2 file I-O

Read file name from command line, e.g., ./projectONE text.txt, to get undergraduate object information. The text.txt format is (contents are just for example)

hint : use int main(int argc,char*argv[])

5 //undergraduate number

Amanda t //undergraduate name

4 //course numbers

music, art, algebra, history

//course list

A, B, F, C //grade list

johny m

5

art, math, physics, biology, writing

A, A-, D+, C-, B

Micheal fox

5

French, Math, study hall, biology, java

F, C+, C-, D, B+

Anonymous Student

3

science, computer science, wriring

C, D+, F

tommy

10

A, B, C, D, E, F, G, H, I, J

B,C-, A, F, D, A+, B, B-, C+, A

steps should follow:

• Define a dynamic array of undergraduate objects to store all information from the file operation

• Print courses, grades and averaged GPA for each undergraduate by calling member functions

• memory release for dynamic array

Explanation / Answer

#include <iostream>
#include <fstream>


using namespace std;

class Undergraduate {
private:
string name ;//- A string that stores the name of the undergradate
int numCourses;// - An integer that tracks how many courses the undergraduate is currently enrolled in
string* courseList;// - A dynamic array of strings used to store the names of the courses that undergraduate is enrolled in
double* gradeList;// - A dynamic array of double used to store the grade for each courses that the undergraduate is enrolled in
static int numundergraduates;// - A static member variable that counts the number of undergraduates created
  
public:
Undergraduate( );
~Undergraduate()
{
   delete this.courseList;
   delete this.gradeList;
}
  
Undergraduate(string name, int numCourses)
{
   this.name=name;
   this.numCourses=numCourses;
}
  
//A public function that prints the undergraduates name, all courses in courseList
//and all grades in gradeList
  
getinfo(Undergraduate Undergraduate)
{
   cout << "Undergraduate Name : " << Undergraduate.name <<endl;
   cout << "All courses : " << Undergraduate.courseList <<endl;
   cout << "All grades : " << Undergraduate.gradeList <<endl;
     
}
  
  
};

int main( ) {
  
   std::ifstream infile("text.txt");
std::string line;
while (std::getline(infile, line))
{
std::istringstream iss(line);
  
  
  

}


  
return 0;
}