Page 318 - Computer science 868 Class 12
P. 318

Program 5      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 rupees 2000, 500, 200, 100, 50, 20,
                               10 and 1.
                               Design a program to accept the amount from the user and display the break-up in descending
                               order  of  denominations  (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:
                               14836
                               Output:
                               One Four Eight Three Six
                               Denomination:
                               2000 * 7 = 14000
                               500 * 1 = 500
                               200 * 1 = 200
                               100 * 1 = 100
                               20 * 1 = 20
                               10 * 1 = 10
                               1 * 6 = 6
                               Example 2:
                               Input:
                               235001
                               Output:
                               Invalid Amount

                 1       import java.util.*;
                 2       class denomination

                 3       {

                 4        int notes[] = {2000, 500, 200, 100, 50, 20, 10, 1};
                 5           int amt;
                 6

                 7           void main()
                 8           {

                 9               Scanner in = new Scanner(System.in);
                10               System.out.print("Enter the amount: ");

                11               amt = in.nextInt();
                12

                13               if (amt > 99999)
                14               {

                15                   System.out.println("Invalid Amount");




                316316  Touchpad Computer Science-XII
   313   314   315   316   317   318   319   320   321   322   323