Write a function piesPrice(dollars, cents, count) that finds how much count pies cost. One pie costs dollars dollars and cents cents. 1 dollar is 100 cents.
dollars and count are 0 or more, cents is from 0 to 99.[totalDollars, totalCents].totalCents is from 0 to 99: every 100 cents make one more dollar. 3 pies at 2 dollars 50 cents cost 7 dollars 50 cents, so the answer is [7, 50], not [6, 150].count is 0, the pies cost nothing: return [0, 0].piesPrice(2, 50, 3)Returns [ 7, 50 ]
piesPrice(10, 15, 2)Returns [ 20, 30 ]
Asked at T-Bank · Source
piesPrice(2, 50, 3)[ 7, 50 ]piesPrice(10, 15, 2)[ 20, 30 ]piesPrice(2, 5, 2)[ 4, 10 ]piesPrice(5, 20, 0)[ 0, 0 ]Hidden tests run on Submit.