What’s My Change?

my-change

Your Challenge


Using either Python or HTML + JavaScript, write a program that prompts the end-user to enter two values:

  • Value 1: Amount to be paid by the customer
  • Value 2: Amount received from the customer

The program should then find out how many banknotes or coins of different values should be returned.
what-s-my-change

Tip:


Your program will accept banknotes of £20, £10 and £5 and the following coins: £2, £1, 50p, 20p, 10p, 5p, 2p, 1p.

The following flowchart will help you get started:
what-s-my-change-flowchart

Extension:


Add some validation rules to ensure that the user has entered valid currency values. You should also check that the amount received from the customer is greater or equal to the amount to be paid.

unlock-access

Solution...

The solution for this challenge is available to full members!
Find out how to become a member:
➤ Members' Area

Did you like this challenge?

Click on a star to rate it!

Average rating 4.2 / 5. Vote count: 13

No votes so far! Be the first to rate this post.

As you found this challenge interesting...

Follow us on social media!

Tagged with: , ,