Computers and Technology, 23.11.2020 14:00 tajonae04
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:
2011
18000
2018
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_info() should use three spaces for indentation.
This is what is given
class Car:
def __init__(self):
self. model_year = 0
# TODO: Declare purchase_price attribute
self. current_value = 0
def calc_current_value(self, current_year):
depreciation_rate = 0.15
# Car depreciation formula
car_age = current_year - self. model_year
self. current_value = round(self. purchase_price * (1 - depreciation_rate) ** car_age)
# TODO: Define print_info() method to output model_year, purchase_price, and current_value
if __name__ == "__main__":
year = int(input())
price = int(input())
current_year = int(input())
my_car = Car()
my_car. model_year = year
my_car. purchase_price = price
my_car. calc_current_value(current_year)
my_car. print_info()
Answers: 1
Computers and Technology, 22.06.2019 10:30
Dave has to create animations for a game. which tool can dave use?
Answers: 3
Computers and Technology, 22.06.2019 22:00
Consider the following declarations (1, 2, 3, 5, 7)class bagtype{public: void set(string, double, double, double, double); void print() const; string getstyle() const; double getprice() const; void get(double, double, double, double); bagtype(); bagtype(string, double, double, double, double); private: string style: double l; double w; double h; double price; }; a.) write the definition of the number function set so that private members are set according to the parametersb.) write the definition of the member function print that prints the values of the data membersc.) write the definition of the default constructor of the class bagtype so that the private member variables are initialized to "", 0.0, 0.0, 0.0, 0.0, respectively d.) write a c++ statement that prints the value of the object newbag.e.) write a c++ statement that declares the object tempbag of type bagtype, and initialize the member variables of tempbag to "backpack", 15, 8, 20 and 49.99, respectively
Answers: 3
Computers and Technology, 23.06.2019 01:30
Which tab is used to change the theme of a photo album slide show? a. design b. view c. transitions d. home
Answers: 1
Computers and Technology, 23.06.2019 08:00
Match the items with their respective descriptions.
Answers: 1
Complete the Car class by creating an attribute purchase_price (type int) and the method print_info(...
Computers and Technology, 20.10.2020 04:01
Mathematics, 20.10.2020 04:01
Computers and Technology, 20.10.2020 04:01
Mathematics, 20.10.2020 04:01
Mathematics, 20.10.2020 04:01
Mathematics, 20.10.2020 04:01
Mathematics, 20.10.2020 04:01
Mathematics, 20.10.2020 04:01
Mathematics, 20.10.2020 04:01
Mathematics, 20.10.2020 04:01
Mathematics, 20.10.2020 04:01