Page 1 of 1

//// Use C++. That is the only language allowed for this program. Don't bother do it if it's not C++. This is my third t

Posted: Fri Jul 01, 2022 5:39 am
by answerhappygod
//// Use C++. That is the only language allowed for thisprogram. Don't bother do it if it's not C++. This is my third timeasking this question because i keep getting irrelevant answers.Please be different.
Thank you !!!! C++ C++ C++ C++ C++
Part 4: Create the Tube Class
Tubes are shipping items that are cylindrical. They have twodimensions: length and circumference. All sizes must be at least.007 (kMinSize) inches. The length plus circumference (the girthfor Tubes) can be a maximum of 108 (kMaxSize) inches.
The Tube class will inherit from the ShippingItem class.
Part 4.1: Write Tube Class Declaration
In the tube.h file add a declaration for the class namedTube.
Start by adding the include guards for the header file.
Add a declaration for the class Tube
Add the notation at the top of the Carton class that has itinherit from the ShippingItem class. Use public inheritance.
Add one private data member.
add a public section with the following
Part 4.2: Write Tube Class Implementation
In the tube.cpp file include the tube.h header file.
Define the static data member kPi and give it the value of3.14159.
Write the implementation for the getter. The getter returns thevalue of the matching data member.
Write the implementation for the setter.
Write the default constructor.
Write the non-default constructor.
Write the destructor. It does not need to do anything. Just addthe { }s
Implement the Volume method. The formula for volume of acylinder is
volume = pi * r2 * h
But we have the circumference instead of the radius. The formulato convert circumference to radius is
r = C / 2pi
So the formula for the volume of a Tube using circumferenceis:
volume = pi(C/2pi) (C/2pi)l
whereC - circumferencel - length
Implement the Girth method. For a tube, the girth is simply thecircumference so this method just needs to return the circumferenceof the Tube.
Implement the Display method.
Part 4.3: Use the Tube Class in Main.cpp
Now we can use the Tube class in main.
Create Tube objects using the default and non-defaultconstructors. When using the non-constructor, use try/catch blocksto handle the exceptions.
Use the Tube objects to call the getter and setter methods.Print out the results to see how these getters and setters areworking. When calling the setters, use try/catch blocks to handlethe exceptions.
Use the Tube objects to call the Volume, Girth and Displaymethods. Print out the results to see how these methods areworking.
Part 4.4: Run the unit tests
Run the unit tests for the Tube class.
In the tests/CMakeLists.txt (there are three CMakeLists.txtfiles so be sure to get the one in the tests folder) uncomment theline for tube by removing the # at the beginning of the line.
Then click the Reload Changes message at the top of thetests/CMakeLists.txt file.
Now run all the tests on the Tube class by runningmain_test.
If any of the tests fail, make changes until all the unit testspass.