Question: Please answer the following using Python: Create a Money class that can store dollars and cents . Please include code for the following functionality to

Please answer the following using Python:

Create a Money class that can store dollars and cents. Please include code for the following functionality to your Money class

default Constructor with two arguments (dollars , cents)

repr overloading for Canonical string representation

str overloading for informal string representation

get_dollars()

get_cents()

set_dollars()

set_cents()

overload operator for +

overload operator for

overload operator for ==

overload operator for >

overload operator for >=

overload operator for

overload operator for =

Please answer the following using Python: Create a Money class that can

Sample shell with Money obiects: >>> m1 = Money() >ml $0.0 >>> print (ml) $0.0 >ml.set dollars (9) >ml.set cents (99) >>ml $9.99 ml.get dollars( >>>ml.get cents >>> m2 Money ( 2 , 56 ) >>m2 $2.56 >>ml m2 $12.55 >>>mlm2 $7.43 False >>>ml > m2 True >>> m1 >= m2 True >>ml

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!