Home /
Expert Answers /
Computer Science /
complete-the-car-class-by-creating-an-attribute-purchase-price-type-int-and-the-method-print-inf-pa775
(Solved):
Complete the Car class by creating an attribute purchase_price (type int) and the method print_inf ...
Complete the Car class by creating an attribute purchase_price (type int) and the method print_info that outputs the car's information. Ex: If the input is: \[ \begin{array}{l} 2011 \\ 18000 \\ 2018 \end{array} \] where 2011 is the car's model year, 18000 is the purchase price, and 2018 is the current year, then print_info() outputs: Car's information: Model year: 2011 Purchase price: \( \$ 18000 \) Current value: \( \$ 5770 \) Note: print_infol should use two spaces for indentation. 4119422847550 ax37ay? \begin{tabular}{|l|l} LAB & 7.17.1: LAB: Car value (classes) \\ ACTIVITY & \end{tabular} main.py Load default template... 1 class Car: def__init__(self): self.model year \( =0 \) self. purchase_price \( =0 \) self.current_value \( =0 \) def calc_current_value(self, current_year): self.current_value \( = \) round(self.purchase_price \( *(1-0.15) * * \) (current_year - self.model_year))
\begin{tabular}{l|l} LAB & 7.17.1: LAB: Car value (classes) \end{tabular} main.py Load default template... \( 8 \quad \) self.current_value \( = \) round(self.purchase_price \( *(1-0.15) * * \) (current_year - self.model_year)) def print_info(self): print("(ar's information:") print(" Model year:", self.model_year) print(" Purchase price: \$", self.purchase_price) print(" Current value: \$", self.current_value)