The world’s Largest Sharp Brain Virtual Experts Marketplace Just a click Away
Levels Tought:
Elementary,Middle School,High School,College,University,PHD
| Teaching Since: | May 2017 |
| Last Sign in: | 406 Weeks Ago, 6 Days Ago |
| Questions Answered: | 66690 |
| Tutorials Posted: | 66688 |
MCS,PHD
Argosy University/ Phoniex University/
Nov-2005 - Oct-2011
Professor
Phoniex University
Oct-2001 - Nov-2016
Question 1: Money dispenser calculator (5 marks)
Write a function that produces the list of NZ notes and coins required to give change for a user-entered amount up to $1000.The amounts are whole dollar amounts (there’s no need for 50c, 20c and 10c coins), so the variables used should be integers.
Â
If the amount is $47, you could pay this with 47 $1 coins but you would normally use a selection of larger notes or coins.In your function you are to use the largest possible notes or coins at each step.So for the example of $47 you would recognise that $100 notes are too big and so is a $50 note so you would move down to $20 notes and so on.
Â
The function must prompt the user for an amount.This becomes the initial balance and as you dispense notes and coins this balance decreases.For example a function may produce the following output:
Enter the initial amount in dollars: 348
$100
$100
$100
$20
$20
$5
$2
$1
Â
A more advanced solution might display something like:
3 x $100
2 x $20
1 x $5
1 x $2
1 x $1
Â
Note that either of these solutions is sufficient to obtain full marks for the question.
Hel-----------lo -----------Sir-----------/Ma-----------dam-----------Tha-----------nk -----------You----------- fo-----------r u-----------sin-----------g o-----------ur -----------web-----------sit-----------e a-----------nd -----------and----------- ac-----------qui-----------sit-----------ion----------- of----------- my----------- po-----------ste-----------d s-----------olu-----------tio-----------n.P-----------lea-----------se -----------pin-----------g m-----------e o-----------n c-----------hat----------- I -----------am -----------onl-----------ine----------- or----------- in-----------box----------- me----------- a -----------mes-----------sag-----------e I----------- wi-----------ll