Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Python Programming Abstraction: makeChange determines the minimum number of couns and bills needed to total to a specified monetary amount. action makeChange determines the minimimum

Python Programming
Abstraction: makeChange determines the minimum number of couns and bills needed to total to a specified monetary amount.
image text in transcribed
image text in transcribed
action makeChange determines the minimimum number of coins and bills needed to total to a specified monetary amount Invocation Prototype: makeChange(amount) Parameters: amount represents a quantity of money. It is a numeric value GEO and LT. 100. Mandatory. Arrives unvalidated.. Desired behavior (normal): Returns an 8-element python list denoting the miminum number of bills and coins that totalto amount. The list should be arranged as follows: List element Count of 0 20-dollar bills 1 10-dollar bills 2 5-dollar bills 3 1-dollar bills quarters dimes nickels pennies Special Note: amount should be rounded to the nearest penny before performing any Desired behavior (errors) if: Any parameter violates its respective interface contract described Action: Return an empty (ie, zero-element) list Exit conditions: No further processing takes place once an error is discovered. State change: No state is retained or changed. General examples: Samples that illustrate behavior with normal input Given: makeChange(3.26) Result [0.0.0.3,1,0,0.1) Given make change(5) Result [0,0,1,0,0,0,0,01 Given makeChange(36.41) Result (1.1.1.1.1.1.1.11 Given makechange (1.001) es that illustrate behavior with anomolous input Action: Return an empty (i.e., zero-element) list Exit conditions: No further processing takes place once an error is discovered State change: No state is retained or changed General examples: Samples that illustrate behavior with normal input Given: makeChange(3.26) Result [0,0,0,3,1,0,0,1) Given: makeChange(5) Result: [0,0,1,0,0,0,0,0] Given: makeChange(36.41) Result: [1,1,1,1,1,1,1,1) Given: makechange(1.001) Result: [0,0,0,1,0,0,0,0) Given: makechange(1.005) Result: [0,0,0,1,0,0,0,1) Given: makechange(amount=1.005) Result: [0,0,0,1,0,0,0,1] Samples that illustrate behavior with anomolous input Given: makeChange() Result: Given: makeChange("1.00") Result

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_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

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

Get Started

Recommended Textbook for

More Books

Students also viewed these Databases questions