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
PLEASE HELP PROGRAMMING WILL GIVE BRAINLIEST
AveGali [126]

Answer:

I think it the answer will be 0,1,2,3,4

Explanation:

7 0
2 years ago
Read 2 more answers
"Create a Python program named detect_column_level_data_entry_errors. When complete, you will run this program to produce a diag
11111nata11111 [884]

Answer:

See explaination

Explanation:

Code for detect_column_level_data_entry_errors.py:

# File: detect_column_level_data_entry_errors.py

# The program will produce a diagnostic report that shows data entry errors that cause column

# totals in the data to be out of balance. Will need to fix cleaned_data.txt until errors resolved.

def main():

input_filename = input('Please enter the input filename: ')

infile = open(input_filename, 'r', encoding='utf8')

total_males = 0

total_females = 0

sum_total = 0

print('\n{0:^40}'.format('Column-Level Data Entry Errors'))

print('\n{0:<10}{1:>10}{2:>10}{3:>10}'.format(

'Age Group', 'Males', 'Females', 'Total'))

for line in infile:

age_group, males, females, total = line.split()

males = int(males)

females = int(females)

total = int(total)

print('{0:<10}{1:>10,}{2:>10,}{3:>10,}'.format(

age_group, males, females, total))

if age_group != 'Total':

total_males = males + total_males

total_females = females + total_females

sum_total = total + sum_total

else:

print('{0:<10}{1:>10,}{2:>10,}{3:>10,}'.format(

'Error', (males-total_males), (females-total_females), (total-sum_total)))

infile.close()

main()

8 0
2 years ago
Your agile team only has one database developer. So the other developers finish their tasks and then wait for their work to be I
Novosadov [1.4K]

Members of an Agile development team often agrees on what tasks to work on and they do it together. The one possible solution to this challenge is to Have the database developer train the rest of the team so there are fewer handoffs.

Agile development team often works together as a team. They as team discuss the task yo take, when it will take place etc.

This team is all about communication, teamwork, problem-solving etc.

Conclusively, A task should be completed by one member on the team, but the team may choose to pair up when doing the work.

Learn more from

brainly.com/question/24383225

See full question below:

Your agile team only has one person who knows how to develop database software. So the other developers finish their tasks and then wait for their work to be Integrated into the database. This creates a pile of backed up work for the database developer. But it also means that the other developers must either wait or add to the growing pile of database work. What's one possible solution to this challenge?

Select an answer:

Have the database developer train the rest of the team so there are fewer handoffs.

Have the software developers split their time between other teams so they're not as productive

Encourage the database developer to work overtime to catch up with their work.

Create a large batch of work so the database developer can focus on finishing

8 0
2 years ago
Which one of the following features can control left and right indents on using markers
QveST [7]
The Feature that can control left and right indents on using markers is Ruler.  The indent marker consists of two triangles and a rectangle.  <span>To change the left indent, click on the very bottom of the indent marker, the rectangle, and drag it to a new position.</span>  <span>The Right Indent is indicated by a single triangle on the Ruler at the current right margin. Click and drag it to change the margin.</span>
3 0
3 years ago
How long before a speech should you begin practicing?
hichkok12 [17]

Answer:

D

Explanation:

4 0
3 years ago
Read 2 more answers
Other questions:
  • Select the correct answer.
    7·2 answers
  • Which of the following would be a tradeoff of a scientific advancement that enables us to catch fish from the ocean faster than
    5·1 answer
  • Used prevalently on the web, it allows for secure messages to be sent between parties without having to agree on, or share, a se
    7·2 answers
  • What are the main purposes of regulatory policies? Check all that apply.
    5·2 answers
  • Markaplier nand jackceptieye are the best YT ever who agrees
    5·2 answers
  • Consider the following definition of the recursive function mystery. int mystery(int first, int last) { if (first &gt; last) ret
    12·1 answer
  • The variable most_recent_novel is associated with a dictionary that maps the names of novelists to their most recently published
    12·1 answer
  • What do you think is the most fascinating aspect of the Internet
    5·2 answers
  • Application software can run without the presence of system software true or false ​
    5·1 answer
  • After data is collected, how is it analyzed?
    10·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!