1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
Alex787 [66]
2 years ago
14

I need help with completing this python code.Complete the Car class by creating an attribute purchase_price (type int) and the m

ethod print_info() that outputs the car's information.Ex: If the input is:2011180002018where 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: 5770Note: print_info() should use three spaces for indentation.class Car:def __init__(self):self.model_year = 0# TODO: Declare purchase_price attributeself.current_value = 0def calc_current_value(self, current_year):depreciation_rate = 0.15# Car depreciation formulacar_age = current_year - self.model_yearself.current_value = round(self.purchase_price * (1 - depreciation_rate) ** car_age)# TODO: Define print_info() method to output model_year, purchase_price, and current_valueif __name__ == "__main__":year = int(input())price = int(input())current_year = int(input())my_car = Car()my_car.model_year = yearmy_car.purchase_price = pricemy_car.calc_current_value(current_year)my_car.print_info()
Computers and Technology
1 answer:
netineya [11]2 years ago
4 0

Answer:

class Car:

   def __init__(self):

       self.model_year = 0

       # TODO: Declare purchase_price attribute

       self.purchase_price = 0

       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

   def print_info(self):

       print("Model year: ",self.model_year)

       print("Purchase year: ",self.purchase_price)

       print("Current value: ",self.current_value)

def 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()

if __name__ == "__main__":

   main()

Explanation:

The Car class in the python program is used to create a car object instance with class methods model_year, purchase_price, and calc_current_value, which accepts as arguments, year, price and current_year respectively. The main function runs if only the python module is run and interpreted to print out the year and current price of a car object instance defined.

You might be interested in
Which statements accurately describe the Outlook interface? Check all that apply.
blagie [28]

Answer:

All are right except the 4th one.

1) Two main elements are items and folders.

2) The content pane contains a list of items to be viewed in the reading pane.

3) The ribbon contains a list of tabs and menu items.

5) The main Outlook menu has a ribbon tab with default commands.

6) File, Home, Send/Receive, Folder, and View are commands on the main ribbon tab.

Explanation:

Hope this helped Justine!

7 0
2 years ago
Which statement describes Augmented Reality (AR) technology?
anyanavicka [17]

Answer:

Augmented Reality (AR) superimposes images and audio over the real world in real time. It does allow ambient light and does not require headsets all the time.

yan po ang szgot

<em>wala</em><em> </em><em>po</em><em> </em><em>kasi</em><em> </em><em>pagp</em><em>i</em><em>p</em><em>ilian</em><em> </em>

<em>HOPE</em><em> </em><em>IT</em><em> </em><em>HELPS</em><em> </em>

<em>pls</em><em> </em><em>follow</em><em> </em><em>ke</em><em /><em /><em />

3 0
3 years ago
Which of the following statements about wide area networks are true? Select 3 options.
Montano1993 [528]

Answer:

abd

Explanation:

connections usually occur through a public network

cool devices in a large geographic area

typically uses Ethernet and wirless routers to connect device

7 0
2 years ago
The ____ is a tool in versions of microsoft office starting with office 2007 that consists of tabs, which contain groups of rela
tankabanditka [31]

The answer is A. The Ribbon is a UI component which was presented by Microsoft in Microsoft Office 2007. It is situated underneath the Quick Access Toolbar and the Title Bar. It includes seven tabs; Home, Insert, Page design, References, Mailing, Review and View. Every tab has particular gatherings of related summons.

6 0
3 years ago
Links to the four default folders can be found on the left side of the file explorer window under the _________ heading:
dimulka [17.4K]

Answer:

Libraries

Explanation:

Document itself is a folder and is not a heading by the way.

Local simply means on the machine you are working and does not have default folders.

Desktop is  name of screen which is used as a gateway for using windows.

So, they cannot be correct answers.

4 0
3 years ago
Read 2 more answers
Other questions:
  • Gina's teacher has sent her a Word document that contains the names of all the students who are participating in the
    11·2 answers
  • When you tell a computer what to do, you are providing input?
    11·1 answer
  • What will the following program display?
    15·1 answer
  • What are the cues that a website is safe to use for exchanging sensitive information?
    10·1 answer
  • HELP!!! Bad things about Helen Keller. I'm doing a debate and i need to prove that Steve Jobs is better than Helen Keller!!
    14·1 answer
  • The program DebugTwo2.cs has syntax and/or logical errors. Determine the problem(s) and fix the program.// This program greets t
    5·1 answer
  • Will give brainliest
    8·1 answer
  • Jiz<br>Active<br>2<br>3<br>- 2(7 - 15)<br>What is the value of<br>4​
    10·2 answers
  • Assignment 3: chabot<br>​
    13·1 answer
  • Radio spectrum is the part of the complete range of electromagnetic waves that is used for radio communication from
    14·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!