Remember to describe your steps in enough detail so someone
Remember to describe your steps in enough detail so someone other than you could follow your algorithm and solve the problem. Also do not write any actual code.
Problem 1:
Describe a function (mini-program) that will accept change needed from a purchase and determine the number of quarters, number of dimes, number of nickels, and number of pennies needed to make the change if you want to minimize the total number of coins used. The number of each coin needed should be sent back to the function call.
Problem 2:
Describe a function (mini-progam) that would accept 7 values from the function call and determine the minimum of those 7 values. Design this function without using the idea of arrays or lists. Send back to the function call the minimum value. Hint, you should use no more than 7 comparisons (relational operators) to find the minimum.
Problem 3:
Describe a function (min-program) that will prompt the user to enter 50 whole numbers and count how many even and odd numbers were entered (0 should be considered an even number). The function should employ a print statement to output the results.
Solution
Problem 1
Start
Input N, the total change in cents needed from a purchase
Let q be the number of quarters.
q = quotient of (N / 25)
l = remainder of (N / 25)
Let d be the number of dimes.
d = quotient of (l / 10)
l = remainder of (l / 10)
Let n be the number of nickels.
n = quotient of (l / 5)
Let p be the number of pennies.
p = remainder of (l / 5)
return q,d,n and p
Stop
-----------------------------------------------------------------------------------
Problem 2
Start
let a1,a2,a3,a4,a5,a6,a7 be the 7 numbers
if (a1<a2) min = a1
else min = a2
if (a3<min) min = a3
if (a4<min) min = a4
if (a5<min) min = a5
if (a6<min) min = a6
if (a7<min) min = a7
return min
Stop
-----------------------------------------------------------------------------------
Problem 3
Start
j = 0
k = 0
for (i=0 and i < 50)
do
print(\"Input the\" i \"th value: \")
accept m
if (m % 2 == 0) j = j+1
else k = k+1
end-for
print \"Even numbers: \" j
print \"Odd numbers: \" k
Stop

