Page 352 - Cs_withBlue_J_C11_Flipbook
P. 352

27.  Write a program in Java to store the elements in two different matrices A and B of order 4 × 4. Find the product of two matrices
                    and store the result in another matrix C.

                      3    2   1    2          -2   -4  -1   0          5   -1  -5   20
                      6    4   5    0           3   6   -5   2         25   15  -6   38
                      7   -1   0    2     x     5   3    4   6    =    -17  -38  2   -8
                      4    3   1    1           0   -2  -2   5          6   3   -13  17
                          A matrix                  B Matrix            C(resultant) Matrix
                 28.  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 500, 200, 100, 50, 20, 10 and 1.
                     Design a program in Java 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:
                       500 * 29  =   14500
                       200 * 1   =   200
                       100 * 1   =   100
                       20 * 1    =   20
                       10 * 1    =   10
                       1 * 6    =   6
                     Example 2:
                     Input:
                       235001
                     Output:
                       Invalid Amount


































                350350  Touchpad Computer Science-XI
   347   348   349   350   351   352   353   354   355   356   357