Question: For this exercise you need to create a Bubble class and construct two instances of the Bubble object. You will then take the two Bubble

For this exercise you need to create a Bubble class and construct two instances of the Bubble object. You will then take the two Bubble objects and combine them to create a new, larger combined Bubble object. This will be done using functions that take in these Bubble objects as parameters.

The Bubble class contains one data member, radius_, and the corresponding accessor and mutator methods for radius_. Create a member function called volume that computes for the volume of a bubble (sphere). Use the value 3.1415 for PI.

You will create a combine_bubble function that receives two parameters (two Bubble objects) and returns a Bubble object. Combining bubbles simply means creating a new Bubble object whose radius is the sum of the two Bubble objects' radii. Take note that the combine_bubble function is not part of thhe Bubble class.

Place the Bubble class and the combine_bubble's function prototype in bubble.hpp. Place combine_bubble's implementation in bubble.cpp. The main function already contains some code, but you need to complete the requirements that is described inside the file.

Please see the sample output below to guide the design of your program. Note that bold values in the samples represent input by the user.

Sample Output

Please enter the radius of the first bubble: 4.5 Please enter the radius of the second bubble: 2.3 The bubbles have now combined and created a bubble with the volume of: 1317.05 

This is in c++.

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 Databases Questions!