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

a. Create a class named Teacher that holds first and last names and the grade le

ID: 3554265 • Letter: A

Question

a. Create a class named Teacher that holds first and last names and the grade level the teacher teaches. include a constructor function that uses default first and last names, such as "ZZZZZZZ" and a default grade level, such as 0, when no arguments are provided.

b. Create a class named Student that holds a Student's first and last name. include a constructor function that uses default first and last names, such as "ZZZZZZZ", when no names are provided.

c. Create a class name Classroom. a Classroom holds a Teacher and an array of 35 Student objects.

d. Create a class named School. a School contains an array of 100 Classroom objects.

e. In a main() demonstration function, declare a pointer to an array of 500 School objects and include code to handle any memory allocation errors that occur. in a loop, declare 500 array objects at a time, continuing to rewrite the main() functions if necessary until you create enough School objects to cause a memory allocation exception. when memory is exhausted, display an appropriate message and terminate the application. save the file as school.cpp

Explanation / Answer

class Teacher{
  
   public:
       string firstName, lastName;
   int gradeLevel;
       Teacher(string fName, string lName, int grade){
           firstName = fName;
           lastName = lName;
           gradeLevel = grade;
       }
       Teacher(){
           firstName = "ZZZZZ";
           lastName = "ZZZZZ";
           gradeLevel = 0;
       }
};
class Student{
  
  
   public:
       string firstName, lastName;
       Teacher(string fName, string lName){
           firstName = fName;
           lastName = lName;
          
       }
       Teacher(){
           firstName = "ZZZZZ";
           lastName = "ZZZZZ";
          
       }

};

class ClassRoom{
   Teacher teacher;
   Student students[35];
  
   public:
       ClassRoom(Teacher t, Student[] s){
           teacher.fistName = t.firstName;
           teacher.lastName = t.lastName;
           teacher.gradeLevel = t.gradeLevel;
          
           for(int i=0;i<35; i++)
               students[i].firstName = s[i].firstName;
               studetns[i].lastName = s[i].lastName;
       }
};

class School{
   public:
   classRoom crs[100];
};

int main(){
   try{
       while(1){
           School *schools = new School[500];
       }
   }
   catch (exception& e){
       cout << "Standard exception: " << e.what() << endl;
   }
}

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote