Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Rewrite the addStudent function in the Course class in Listing 11.16, Course.cpp Download Course.cppto throw a runtime_error if the number of students exceeds the capacity.

Rewrite the addStudent function in the Course class in Listing 11.16, Course.cpp Download Course.cppto throw a runtime_error if the number of students exceeds the capacity. Also, complete coding the function dropStudent.

#include  #include "Course.h" using namespace std; Course::Course(const string& courseName, int capacity){ numberOfStudents = 0; this->courseName = courseName; this->capacity = capacity; students = new string[capacity]; } Course::~Course(){ delete [] students; } string Course::getCourseName() const{ return courseName; } void Course::addStudent(const string& name){ students[numberOfStudents] = name; numberOfStudents++; } void Course::dropStudent(const string& name){ // Complete this code here } string* Course::getStudents() const{ return students; } int Course::getNumberOfStudents() const{ return numberOfStudents; }

NOTE: Be sure to submit "all" files that I may need to test your code.

Please include the output

Please do the code for separate file and show the screenshot of your IDE

IN C++

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Databases And Information Systems 1 International Baltic Conference Dbandis 2020 Tallinn Estonia June 19 2020 Proceedings

Authors: Tarmo Robal ,Hele-Mai Haav ,Jaan Penjam ,Raimundas Matulevicius

1st Edition

303057671X, 978-3030576714

More Books

Students also viewed these Databases questions

Question

Solve the integral:

Answered: 1 week ago

Question

What is meant by Non-programmed decision?

Answered: 1 week ago

Question

What are the different techniques used in decision making?

Answered: 1 week ago