1 Here is my question and I had attached 4acpp file also ie
Solution
Please find the answer to the above question as follows:-
#include<iostream>
#include<string.h>
using namespace std;
class Student{
private:
string name;
int idNum;
double gpa;
public:
Student(){}
Student(string, int, double);
string getName(){
return name;
}
void setStudentName(string n){
name = n;
}
string formatString(){
}
int getidNum(){
return this->idNum;
}
double getGPA(){
return gpa;
}
void setidNum(int a){
idNum = a;
}
void setGPA(double a){
gpa = a;
}
};
Student::Student(string a, int b, double c){
setStudentName(a);
setidNum(b);
setGPA(c);
}
int main(){
const string Name = \"John Smith\";
const int STUID = 123456789 ;
const double GPA1 = 4.0;
const double GPA2 = 2.34;
Student stu1;
stu1 = Student(Name, STUID, GPA1);
cout<<\"Name: \"<<stu1.getName()<<endl;
cout<<\"Id Number: \"<<stu1.getidNum()<<endl;
cout<<\"GPA: \"<<stu1.getGPA()<<endl;
stu1.setGPA(GPA2);
cout<<\"Student Name: \"<<stu1.getName()<<endl;
cout<<\"Student Id num: \"<<stu1.getidNum()<<endl;
cout<<\"Student GPA: \"<<stu1.getGPA()<<endl;
const string Name2 = \"Pistol Pete\";
const int STUID2 = 1;
Student stu2;
stu2 = Student(Name2, STUID2, GPA1);
cout<<\"Name: \"<<stu2.getName()<<endl;
cout<<\"Id Number: \"<<stu2.getidNum()<<endl;
cout<<\"GPA: \"<<stu2.getGPA()<<endl;
cout<<\"Student Name: \"<<stu2.getName()<<endl;
cout<<\"Student Id num: \"<<stu2.getidNum()<<endl;
cout<<\"Student GPA: \"<<stu2.getGPA()<<endl;
}

