Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

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

Introduction to Wireless and Mobile Systems

Authors: Dharma P. Agrawal, Qing An Zeng

4th edition

1305087135, 978-1305087132, 9781305259621, 1305259629, 9781305537910 , 978-130508713

More Books

Students also viewed these Programming questions