Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

PYTHON LANGUAGE: Write test cases to test the following program for accuracy, us

ID: 3574343 • Letter: P

Question

PYTHON LANGUAGE:

Write test cases to test the following program for accuracy, using a black-box testing method. The program is intended to make change for a purchase, given a cost for the item and an amount of money tendered.

def makeChange(cost, tender):

change = tender - cost

print("Change due: ", change)

dollars = change//100

print(dollars, 'dollars', end = (','))

remain = change % 100

quarters = remain // 25

print(quarters, 'quarters', end = (','))

tryDimes= remain - quarters * 25

dimes = tryDimes //10

print(dimes, 'dimes', end = (','))

tryNickels = tryDimes % 10

nickels = tryNickels //5

print(nickels, 'nickles', end = (','))

pennies = tryNickels % 5

print(pennies, 'pennies')

cost = int(input("Enter the cost of the item: " ))

tender = int(input("Enter the amount tendered: " ))

makeChange(cost, tender)

Explanation / Answer

HI, We can have many type of test cases to test this program:


### Test clases
1. cost > tender:
cost = 300
tender = 230

2.
cost < tender
cost = 432
tender = 600

3.
cost == tender

cost = 400, tender = 400

4. We can also test with negative valuse for cost and tender