Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Python. Answer the questions with Your Code Here : Complete the Mint and Coin classes so that the coins created by a mint have the

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

image text in transcribed

image text in transcribed

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

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Students also viewed these Databases questions

Question

Bickley. Bates' Guide to Physical Examination and History Taking

Answered: 1 week ago

Question

General Purpose of Your Speech Analyzing Your Audience

Answered: 1 week ago

Question

Ethical Speaking: Taking Responsibility for Your Speech?

Answered: 1 week ago