Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

4. ( 6 points) Currency in the United Kingdom consists of the pound (denoted ) and penny (denoted p, plural: pence), where 1=100p. UK coins

image text in transcribed
image text in transcribed
4. ( 6 points) Currency in the United Kingdom consists of the pound (denoted ) and penny (denoted p, plural: pence), where 1=100p. UK coins come in 1p,2p,5p,10p,20p,50p,1, and 2 denominations. At current exchange rates, 1 is equivalent to about 1.24 U.S. dollars. Write a program named uk change maker.py that allows the user to enter a number of pence. You may assume that the user input is a non-negative integer. The program should then compute and display a combination of the coins above that add up to that amount. Use the same change making algorithm that we discussed in class for American coins, involving integer division and mod. At the end of the program, also display the equivalent amount of money in U.S. dollars, rounded to the nearest cent. (The USD amount should not be divided into coins.) Example program run (underlined parts indicate what the user enters) Enter number of pence: 588 2 pound coins: 2 1 pound coins: 1 50p coins : 1 20p coins: 1 10p coins : 1 5p coins : 1 2p coins: 1 1p coins: 1 In USD, that's $7.29

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Essential Data Protection For Estate Agencies In Singapore 2024

Authors: Yang Yen Thaw Yt

1st Edition

B0CQK79WD3, 979-8872095392

More Books

Students also viewed these Databases questions