Question: In C++ Make a class which objects represent, each one, a Chewing Gum Box (use dynamic memory). Also the class must include the following services

In C++

Make a class which objects represent, each one, a Chewing Gum Box (use dynamic memory). Also the class must include the following services for it's objects:

Show the box information

Obtain the chewing gum box weight with the chewing gum inside

Determine if two boxes are equal

Use arrays and dynamic memory

I have the declarations for both classes just missing the rest have some doubt on how to complete

const int full_box = 12;

class BoxOfGum { private: ChewingGum gums [full_box]; int quantity; public: BoxOfGum(); BoxOfGum(const BoxOfGum & box); ~BoxOfGum (); BoxOfGum & operator = (const BoxOfGum & box); int quantityGums() const; bool operator == (const BoxOfGum & box) const; bool operator != (const BoxOfGum & box) const; friend ostream & operator << (ostream & out, const BoxOfGum & box); static int maxGums(); BoxOfGum & operator + (const ChewingGum & gum); BoxOfGum & operator + (const double gums); BoxOfGum & operator + (const BoxOfGum & box); const ChewingGum & operator [] (int ind) const; ChewingGum & operator [] (int ind) double weight_(); Both classes need to be link part of the whole/part. Thanks in advance for the help.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!