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
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.24U.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 Page 2 of 6 OMP 1900 - Spring 2023 Lab 2 Due Sun., Feb. 12, by 2359 Central 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 5 p 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

Hands-On Database

Authors: Steve Conger

2nd Edition

0133024415, 978-0133024418

More Books

Students also viewed these Databases questions