Since I am not getting any error I can't find what is wrong with the program.
The text of the exercise is:
"Create a class named StudentGrade. Include fields for a student ID number, studentname (use the Person class from Exercise 3), numeric test score, possible points, andletter grade.
Create a constructor that requires the student ID, name, and test score, and allows a fourth parameter that holds possible test points. If a value for possible points isnot passed to the constructor, the possible points value defaults to 100. (If a 0 value ispassed for possible points, force possible points to 1 so that you do not divide by 0 whencalculating a grade.)
The constructor calculates the student’s percentage (divides scoreby possible points) and assigns a letter grade based on: 90% and above (A), 80% (B), 70%(C), and 60% (D). Create a main()function that instantiates and displays enoughStudentGrade objects to test a variety of scores and possible point values"
Code:#include <iostream> using namespace std; class Person { private: string lastName; string firstName; string zipCode; public: Person(); Person(string , string , string); string getLastName(); string getFirstName(); string getZipCode(); void setFirstName(string); void setLastName(string); }; Person::Person() { lastName = firstName = zipCode = "X"; } Person::Person(string lName, string fName, string zCode) { lastName = lName; firstName = fName; zipCode = zCode; } string Person::getLastName() { return lastName; } string Person::getFirstName() { return firstName; } string Person::getZipCode() { return zipCode; } void Person::setFirstName(string firstName) { this->firstName = firstName; } void Person::setLastName(string lastName) { this->lastName = lastName; } class StudentGrade { private: int idNum; int testScore; int possiblePoints; char letterGrade; Person Student; public: StudentGrade(int , string, int, int = 100); char getLetterGrade(); }; StudentGrade::StudentGrade(int idNum, string firstName, int testScore, int possiblePoints) { Student.setFirstName(firstName); this->idNum = idNum; if(possiblePoints = 0) possiblePoints = 1; if(testScore/possiblePoints >= 90) letterGrade = 'A'; if(testScore/possiblePoints >= 80) letterGrade = 'B'; if(testScore/possiblePoints >= 70) letterGrade = 'C'; if(testScore/possiblePoints >= 60) letterGrade = 'D'; } char StudentGrade::getLetterGrade() { return letterGrade; } int main() { StudentGrade NI(21, "Nikola" , 63 , 100); cout << NI.getLetterGrade(); return 0; }