Question: This is a python problem. Problem 3 [35 points | ChangeJar. In this problem, you are asked to create a class for change jars. A

This is a python problem.This is a python problem. Problem 3 [35 points | ChangeJar. Inthis problem, you are asked to create a class for change jars.

Problem 3 [35 points | ChangeJar. In this problem, you are asked to create a class for change jars. A change jar contains an arbitrary collection of cons i.e., quarters. dimes. nickels, and pennies. There are no dollar bills of any denomination in a change jar. We may use change jars to get exact change for some specified amount, or we may add more coins into it. Create a module called changejar.py to implement these and other methods for change jars in a class called ChangeJar. Further details are provided below: 1. init_: The constructor has a single parameter, which is a dictionary of key:value pairs in which the keys must be 25, 10, 5, or 1 (for quarters, dimes, nickels, and pennies). All other keys are invalid (you may raise an exception in this case). The value associated with each key is the number of coins of that denomination in the change jar. Note that not every key need appear in the parameter. If a key does not appear, it means that there are no coins of that denomination in the jar. Set the default value of the parameter to be the empty dictionary, which will allow us to create change jars with no quarters, dimes, nickels, or pennies The constructor should create a dictionary as an instance attribute which has exactly four keys: 25, 10, 5, and 1. The value associated with each key should be the number of coins of that type in the jar. For example, the statement J- ChangeJar (125:8, 5:10, 1:45]) creates a change jar that has 8 quarters, 0 dimes, 10 nickels, and 45 pennies. The statement J = ChangeJar) creates a change jar with 0 quarters, 0 dimes, 0 nickels, and 0 pennies

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!