Question
Redesign and create a Box class, which has the functions as below. Design and create a Box class, which has below methods. A constructor that
Redesign and create a Box class, which has the functions as below. Design and create a Box class, which has below methods. A constructor that accepts the width, height and depth of a box as parameters. A constructor that receives a box's width, height and depth as the parameters, [1 mark/ marks] A static function displayBoxCount that displays the number of boxes that have been created. A static method displayBoxCount that displays the total number of boxes that have been created [2 marks/ marks) A calcVolume function that calculates and returns the contents of the box. A calcVolume method that calculates and returns the box's volume. [2 marks) A calcSurfaceArea function that calculates and returns the box's surface area. [2 marks] A scale function that accepts a scale ratio and scales all dimensions of the box. A scale method that receives a scaling ratio and scales all the dimensions of the box. [1 mark] An add function that accepts a box and returns a new box whose dimensions are a combination of the current box and the perimeter box. An add method that receives a box as parameter and returns a new box with the combined dimensions of current box and parametric box. [2 marks] A str function that returns words indicating the dimensions of a box. A_str_method which returns a string that shows the box's dimensions. [1 mark / marks] . An example of how above methods are used is illustrated below: bi - Box (2.0,3.0,2.0) b2 - Box (3.0, 2.0,3.0) b3 - bl.add( 2) Box.displayBoxCount() # \"Total Boxes created is: 3\" will be displayed. print (13) \"Box Dimension (Length, Width, Depth): 5.00,5.00,5.00\" will be displayed. print(b1.calcVolume()) # \"12.00\" will be displayed. print (b2.calcSurfaceArea()) # \"42.00\" will be displayed b2.scale(2.0) print (12) # \"Box Dimension (Length, Width, Depth): 6.00,4.00,6.00\" will be displayed .
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started