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?

A) class Geo_Calc:
def __init__(self):
self.numOfCalcs = 0
def clearTotal(self):
self.numOfCalcs = 0
def returnTotal(self):
return self.numOfCalcs
def volume_of_cube(self,l,w,h):
numOfCalcs += 1
return l * w * h
def volume_of_cylinder(self,r,h):
numOfCalcs += 1
return math.pi * r * r * h

B) class Geo_Calc:
def __init__(self):
self.numOfCalcs = 0
def clearTotal(self):
self.numOfCalcs = 0
def returnTotal(self):
return self.numOfCalcs
def volume_of_cube(self):
self.numOfCalcs += 1
return l * w * h
def volume_of_cylinder(self):
self.numOfCalcs += 1
return math.pi * r * r * h

C) class Geo_Calc:
def __init__(self):
self.numOfCalcs = 0
def clearTotal(self):
self.numOfCalcs = 0
def returnTotal(self):
return self.numOfCalcs
def volume_of_cube(self):
numOfCalcs += 1
return l * w * h
def volume_of_cylinder(self):
numOfCalcs += 1
return math.pi * r * r * h



Answer :

Other Questions