Question: If programming a class to represent a geometry calculator, which class containing methods with parameters could be used to calculate the volume of a cube
If programming a class to represent a geometry calculator, which class containing methods with parameters could be used to calculate the volume of a cube with length l width w and height h; the volume of a cylinder with radius r and height h; and increment the total number of calculations performed?
class GeoCalc:
def initself:
self.numOfCalcs
def clearTotalself:
self.numOfCalcs
def returnTotalself:
return self.numOfCalcs
def volumeofcubeself:
numOfCalcs
return l w h
def volumeofcylinderself:
numOfCalcs
return math.pi r r h
class GeoCalc:
def initself:
self.numOfCalcs
def clearTotalself:
self.numOfCalcs
def returnTotalself:
return self.numOfCalcs
def volumeofcubeselflwh:
numOfCalcs
return l w h
def volumeofcylinderselfrh:
numOfCalcs
return math.pi r r h
class GeoCalc:
def initself:
self.numOfCalcs
def clearTotalself:
self.numOfCalcs
def returnTotalself:
return self.numOfCalcs
def volumeofcubeselflwh:
self.numOfCalcs
return l w h
def volumeofcylinderselfrh:
self.numOfCalcs
return math.pi r r h
class GeoCalc:
def initself:
self.numOfCalcs
def clearTotalself:
self.numOfCalcs
def returnTotalself:
return self.numOfCalcs
def volumeofcubeself:
self.numOfCalcs
return l w h
def volumeofcylinderself:
self.numOfCalcs
return math.pi r r h
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
