Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

A construction company specializes in providing parking solutions for their cust

ID: 3836256 • Letter: A

Question

A construction company specializes in providing parking solutions for their customers. Although the company does parking lots and parking decks they look at them broadly as a parking solution. The owner looks at a parking lot as being a parking solution with 1 level and a parking deck as being a parking solution of more than 1 level. Because of this approach we can treat parking solutions as the same regardless of whether it is a parking lot or a parking deck its only the cost that will differ. Parking solution with 1 level (a.k.a parking lot), the estimated cost is: $1, 685.43* number of parking spaces Example: a 1 level solution with 100 spaces is $168, 543,00=$1, 685, 43*100 *Parking Solution with more than 1 level (a.k.a parking deck) the estimated cost is $26, 236.71 * number of parking spaces plus $1,000,000,00 per level for each level above 1 Example: a 3 level solution with 100 spaces is $4, 623, 671.00 = $26, 236.71* 100 + (3 - 1)* 1,000,000 The company wants a small program for estimating the cost of a parking solution that will ask the user for the number of levels and the number of parking spaces. For this exam you will be writing a portion of the class parking solution per the UML shown below. The class parking solution has two attributes (fields): level [an int] and num spaces [an in] The parking solution should have the following. Constructor which receives a data type of an int for the number of levels, and an int for the number of spaces cost() will calculate the cost of the ParkingSolution based on levels and numSpaces - (note the numbers 1685.43 and the 26236.71 and the 1000000 can all be hardcoded in the formulas) space below, write the contents of the method cost()

Explanation / Answer

class ParkingSolution(object):
'''Default constructor to read in the variables/values that we will use in the class Parking Solution'''
def __init__(self,levels,numSpaces):
self.levels = levels
self.numSpaces = numSpaces
  
''' Method to calculate the cost based on no.of levels n spaces'''
def cost(self):
if self.levels >= 0:
if self.levels == 1:
cost_value = 1685.43 * self.numSpaces
return '$' + str(cost_value)
else:
cost_value = 26236.71 * self.numSpaces + (self.levels - 1) * 1000000
return '$' + str(cost_value)
  
  
if __name__ == '__main__':
x1 = ParkingSolution(1,100)
print(x1.cost())
x2 = ParkingSolution(3,100)
print(x2.cost())
  
  

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote