Question: PYTHON QUESTION You will be programming anthoney class. There will be only one instance variable (attibute), representing the amount. Include the following A constructor that
You will be programming anthoney class. There will be only one instance variable (attibute), representing the amount. Include the following A constructor that takes a float argument. Assign the value of the float argument to the instance variable. amount. . Implement the str_ method to display the instance variable amount with a dollarsign in front,comma thousands separator, and 2 digits after the decimal. This method should take no arguments. print(money1)-> $12,345.78 . Implement the add method. This method should take one argument, another money object. This method should return a new money object with an amount that equals the sum of the two money object operands. - money3 money1 + money2 Implement the sub method. This method should take one argument, another money object. This method should return a new money object with an amount that equals the difference between the money objects. - money3 money1 - money2 To test your class, construct 2 money objects with different, nonzero amounts. Print them both. Ad therm together and print the new money object. Subtract one from the other and print the new money object Next . Previous
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
