Programming Examples
Java program to print denomination of an input amount and also print the number of notes
A bank intends to design a program to display the denomination of an input amount, up to 5 digits. The available denomination with the bank are of rupees 1000 , 500 , 100 , 50 , 20 , 10 , 5 , 2 , and 1.
Design a program to accept the amount from the user and display the break-up in descending order of denomination. (i.e. preference should be given to the highest denomination available) along with the total number of notes. [Note: Only the denomination used should be displayed]. Also print the amount in words according to the digits.
Example 1
INPUT : 14856
OUTPUT : ONE FOUR EIGHT FIVE SIX
DENOMINATION :
1000 x 14 = 14000
500 x 1 = 500
100 x 3 = 300
50 x 1 = 50
5 x 1 = 5
1 x 1 = 1
TOTAL = 14856
TOTAL NUMBER OF NOTES = 21
Example 2
INPUT : 6043
OUTPUT : SIX ZERO FOUR THREE
DENOMINATION :
1000 x 6 = 6000
20 x 2 = 40
2 x 1 = 2
1 x 1 = 1
TOTAL = 6043
TOTAL NUMBER OF NOTES = 10
Example 3
INPUT : 235001
OUTPUT : INVALID AMOUNT
Output