Question: Python. Answer the questions with Your Code Here : Please check your answer before submitting... Complete the Mint and Coin classes so that the coins

Python. Answer the questions with "Your Code Here" :

Please check your answer before submitting...

Python. Answer the questions with "Your Code Here" : Please check your

answer before submitting... Complete the Mint and Coin classes so that the

Complete the Mint and Coin classes so that the coins created by a mint have the correct year and worth Each Mint instance has a year stamp. The update method sets the year stamp to the current_year class attribute of the Mint class The create method takes a subclass of Coin and returns an instance of that class stamped with the mint 's year (which may be different from Mint.current_year if it has not been updated.) A Coin 's worth method returns the cents value of the coin plus one extra cent for each year of age beyond 50. A coin's age can be determined by subtracting the coin's year from the current_year class attribute of the Mint class. class Mint: ""A mint creates coins by stamping on years. The update method sets the mint's stamp to Mint.current_year. >>>mint - Mint >>> mint.year 2017 >>dime -mint.create(Dime) >> dime.year 2017 >>> Mint.current-year 2100 # Time passes >>> nickel - mint.create(Nickel) >> nickel.year 2017 >>> nickel.worth() # 5 cents + (83-50 years) # The mint has not updated its stamp yet >>> mint.update() # The mint's year is updated to 2100 >>> Mint.current year2175 >>> mint.create (Dime).worth() # 10 cents + (75-50 years) 35 >>> Mint().create(Dime).worth() # A new mint has the current year 10 > dime.worth() 118 >>> Dime . cents 20 # Upgrade all dimes! >> dime.worth 128 # More time passes # 10 cents + (160-50 years) # 20 cents + (160-50 years) current_year 2017 current_year 2017 def init_ (self): self.update() def create(self, kind): YOUR CODE HERE def update(self): YOUR CODE HERE class Coin: def init_(self, year): self.year-year def worth(self): YOUR CODE HERE class Nickel(Coin): cents-5 class Dime (Coin): cents 10

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!