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”

EBK JAVA PROGRAMMING
9th Edition
ISBN:9781337671385
Author:FARRELL
Publisher:FARRELL
Chapter6: Looping
Section: Chapter Questions
Problem 5GZ
icon
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
steps

Step by step

Solved in 3 steps with 2 images

Blurred answer
Knowledge Booster
Single source shortest path
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.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
EBK JAVA PROGRAMMING
EBK JAVA PROGRAMMING
Computer Science
ISBN:
9781337671385
Author:
FARRELL
Publisher:
CENGAGE LEARNING - CONSIGNMENT
C++ Programming: From Problem Analysis to Program…
C++ Programming: From Problem Analysis to Program…
Computer Science
ISBN:
9781337102087
Author:
D. S. Malik
Publisher:
Cengage Learning