The declaration for the schoolbus class instances of the


class SchoolBus
{
public:
SchoolBus(int seats, int seatedStudents);
bool addStudents(int students);
bool removeStudents(int students);
int getStudents() const;

private:
int seats;
int seatedStudents;
};
Figure 1

The declaration for the SchoolBus class is shown in Figure 1. Instances of the SchoolBus class represent school buses of varying sizes. The class provides functions to add and remove students. The add and remove functions return false and do not modify the state of the object if the operation can not be done exactly as requested. For example, if there are 3 empty seats and you try to add 5 students, then the addStudents function returns false and does not change the number of seated students. There is a single accessor function called getSeatedStudents, which returns the total number of students seated in the bus.

1) Draw the UML class diagram for the SchoolBus class given in Figure 1

Request for Solution File

Ask an Expert for Answer!!
Basic Computer Science: The declaration for the schoolbus class instances of the
Reference No:- TGS01037444

Expected delivery within 24 Hours