Suppose an ATM has two sections of 1000 and 500 rupees note. There are 20 notes of 500 and 10 notes of 1000. You can withdraw the amount of either 1000 or 5,000. After each transaction, you also need to decrement and update the number of notes of each denomination (i.e. 500 and 1000). There are rules inside the ATM for dispatching the amount. If the amount is 1000 and number of notes of 500 are greater than 2 then dispatch 500 notes, otherwise check for 1000 notes and dispatch 1000 note. If both options are not possible then output “Transaction not possible” If the amount is 5000 and the number of notes of 500 is greater than 2 and notes of 1000 are greater than 4, then dispatch 2 notes of 500 and 4 notes of 1000, otherwise, if there are 5 notes of 1000, then dispatch 5 notes of 1000. If both options are not possible then output “Transaction not possible”
Suppose an ATM has two sections of 1000 and 500 rupees note. There are 20 notes of 500 and 10 notes of 1000. You can withdraw the amount of either 1000 or 5,000. After each transaction, you also need to decrement and update the number of notes of each denomination (i.e. 500 and 1000). There are rules inside the ATM for dispatching the amount. If the amount is 1000 and number of notes of 500 are greater than 2 then dispatch 500 notes, otherwise check for 1000 notes and dispatch 1000 note. If both options are not possible then output “Transaction not possible” If the amount is 5000 and the number of notes of 500 is greater than 2 and notes of 1000 are greater than 4, then dispatch 2 notes of 500 and 4 notes of 1000, otherwise, if there are 5 notes of 1000, then dispatch 5 notes of 1000. If both options are not possible then output “Transaction not possible”
Chapter6: Looping
Section: Chapter Questions
Problem 5GZ
Related questions
Question
Suppose an ATM has two sections of 1000 and 500 rupees note. There are 20 notes of 500 and 10 notes of 1000. You can withdraw the amount of either 1000 or 5,000. After each transaction, you also need to decrement and update the number of notes of each denomination (i.e. 500 and 1000).
There are rules inside the ATM for dispatching the amount.
- If the amount is 1000 and number of notes of 500 are greater than 2 then dispatch 500 notes, otherwise check for 1000 notes and dispatch 1000 note. If both options are not possible then output “Transaction not possible”
- If the amount is 5000 and the number of notes of 500 is greater than 2 and notes of 1000 are greater than 4, then dispatch 2 notes of 500 and 4 notes of 1000, otherwise, if there are 5 notes of 1000, then dispatch 5 notes of 1000. If both options are not possible then output “Transaction not possible”
Expert Solution
This question has been solved!
Explore an expertly crafted, step-by-step solution for a thorough understanding of key concepts.
Step by step
Solved in 3 steps with 2 images
Knowledge Booster
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.Recommended textbooks for you
EBK JAVA PROGRAMMING
Computer Science
ISBN:
9781337671385
Author:
FARRELL
Publisher:
CENGAGE LEARNING - CONSIGNMENT
C++ Programming: From Problem Analysis to Program…
Computer Science
ISBN:
9781337102087
Author:
D. S. Malik
Publisher:
Cengage Learning
EBK JAVA PROGRAMMING
Computer Science
ISBN:
9781337671385
Author:
FARRELL
Publisher:
CENGAGE LEARNING - CONSIGNMENT
C++ Programming: From Problem Analysis to Program…
Computer Science
ISBN:
9781337102087
Author:
D. S. Malik
Publisher:
Cengage Learning