Write the header and the implementation files (.h and .cpp separately) for a class called Course,...

80.2K

Verified Solution

Question

Programming

  1. Write the header and the implementation files (.h and .cppseparately) for a class called Course, and asimple program to test it (C++), according to the followingspecifications:                   
  1. Your class has 3 member data: an integer pointer that will beused to create a dynamic variable to represent the number ofstudents, an integer pointer that will be used to create a dynamicarray representing students’ ids, and a double pointer that will beused to create a dynamic array to represent the GPAs of eachstudent.
  1. Your class has the following member functions:

       

  1. a constructor with an int parameter representing the number ofstudents; the constructor creates the dynamic variable and sets itto the int parameter, creates the two dynamic arrays and setseverything to zero.

  1. a function which reads in all the ids and the GPAs into theappropriate arrays.
  1. a function called print_info which, for each student, doesall of the

               following:

               It prints the student’s id and GPA. If the student’s GPA is greaterthan or equal to 3.8, it prints “an honor student”.

  1. a destructor (hint: delete array)
  2. create 5 random instances of Course objects to represents 5sessons of CSC211, each session includes 20 students, assign randomscore to each student, calculate the average GPA of all 100students.

Answer & Explanation Solved by verified expert
3.8 Ratings (397 Votes)
Ans Since It is not specified in the question hence all the data members are declared as private and an extra utility function to get average of GPA per    See Answer
Get Answers to Unlimited Questions

Join us to gain access to millions of questions and expert answers. Enjoy exclusive benefits tailored just for you!

Membership Benefits:
  • Unlimited Question Access with detailed Answers
  • Zin AI - 3 Million Words
  • 10 Dall-E 3 Images
  • 20 Plot Generations
  • Conversation with Dialogue Memory
  • No Ads, Ever!
  • Access to Our Best AI Platform: Flex AI - Your personal assistant for all your inquiries!
Become a Member

Other questions asked by students