Here is my question I had attached 4acpp file also and as we
Solution
// Student
 // Name: Bharath kumar Nreddy
 // Section: 003
 // ID: 9999-92410
 // example: class constructor
#include <iostream>
 using namespace std;
 #include <iomanip>
 #include <sstream>
class Student{
   
 private:
 string name;
 int idNum;
 double gpa;
   
 public:
 Student () { }//initialize student object
 Student(string, int, double);
 string getName(){
 //Return the name of the student;
 return name;
 }
 //Write a function called getGPA that returns the GPA of the student.
 double getGPA(){
 //returns the GPA of the student.
 return gpa;
 }
 //Write a function called getIdNum that returns the idNum
 //of the student
 double getIdNum(){
 //returns the idNum of the student.
 return idNum;
 }
   
 //Mutator: changes the student name
   
 void setStudentName(string n){
 name=n;
 }
 //Write a mutator called setGPA, which takes a double
 //and changes the GPA of the student
 void setGPA(double g){
 gpa=g;
 }
   
 //call user defined toString function Returns a formatted string of student
 string formatString(){
 //for formating the idNum for the leading zero
 stringstream ss;
 ss << setw(9) << setfill(\'0\') << idNum;
 string s1 = ss.str();
   
 string s=\"Student name: \" + name +\"\ Student ID num: \"+ s1 +\"\ Student GPA: \"+ std::to_string(gpa) +\"\ \";
 return s;
 }
 };
Student::Student(string a, int b, double c){
 //save namePar to class variable name
 name=a;
 //save idNumPar to class variable idNum
 idNum=b;
 //save gpaPar to class variable gpa
 gpa=c;
 } //End of Student::Student
int main()
 {
 //Constant
 const string NAME=\"Bharath kumar Nreddy\";
 const int STUID=999992410;
 const double GPA1=4.00;
 const double GPA2=2.34;
 
 Student stud1;
 stud1= Student(NAME,STUID,GPA1);
 cout<< \"\ Name: \"<<stud1.getName()<<endl;
 cout<< \"Id Number: \"<<stud1.getIdNum()<<endl;
 std::cout << std::setprecision(2);
 cout<< \"GPA: \"<<setprecision(2)<< fixed <<stud1.getGPA()<<endl;
 
 //setting the GPA using mutator
 stud1.setGPA(GPA2);
 cout<<stud1.formatString();
 
 //Create a second student Object
 //Write a name of Pistol Pete, a gpa of 4.00.
 //and student id of 000000001
 
 Student stud2;
 const string NAME2=\"Pistol Pete\";
 const int STUID2=000000001;
 const double GPA3=4.00;
 stud2=Student(NAME2, STUID2, GPA3);
 //print out this student same as above
 cout<< \"Name: \"<<stud2.getName()<<endl;
 cout<< \"Id Number: \"<<stud2.getIdNum()<<endl;
 cout<< \"GPA: \"<<setprecision(2)<< fixed <<stud2.getGPA()<<endl;
 cout<<stud2.formatString();
 
 
 return 0;
 } //end of main
 /*****************output****************/
Name: Bharath kumar Nreddy
 Id Number: 9.99992e+08 GPA: 4.00
 Student name: Bharath kumar Nreddy
 Student ID num: 999992410 Student GPA: 2.340000
 Name: Pistol Pete   
 Id Number: 1.00
 GPA: 4.00
 Student name: Pistol Pete
 Student ID num: 000000001
 Student GPA: 4.000000
 sh-4.3$ ^C
Note: I have taken your name and section from the 4a.cpp file. Please ask if you have any question. God Bless you !!



