Page 214 - Cs_withBlue_J_C11_Flipbook
P. 214

4.  Write a Java program to input 10 numbers and print the sum of all the even numbers and product of all the numbers ending with 4.
                  5.  The management of a shopping mall decided to give the following discount on the purchase amount of the customers during a
                    festival season.
                     Purchase Amount                     Discount%
                     Up to ` 2000                        2.5%
                    ` 2001 to ` 4000                     4%
                    ` 4001 to ` 7000                     7%
                     More than `  7000                   10%
                     Write a Java program to input the Customer Name and Purchase Amount and calculate the discount he would receive. Also, print
                    the customer name and discounted amount.
                  6.  Write a Java program to input the name, the consumer number and the number of calls made by the consumer. Print the amount
                    that is to be paid based on the following criteria:
                     No. of calls                        Rate/call
                     More than 250 calls                 5/-
                     150 to 249 calls                    4/-
                     75 to 149 calls                     3/-
                     Less than 75 calls                  2/-
                     Also, a surcharge of 2.5% on the bill amount is to be paid by the consumer.
                     Display the output in the following pattern:
                     Name of consumer: ______________
                     Consumer Number: ______________
                     Number of calls: ____________
                     Bill amount before surcharge added: ________
                     Bill amount with surcharge: ____________
                  7.  An electronics shop has announced the following seasonal discounts on the purchase of certain items:

                      Purchase amount in `   Discount on Laptop  Discount on Desktop PC
                     0 – 25000                  0.0%                5.0%
                     25001 – 57000              5.0%                7.6%
                     57001 – 100000             7.5%                10%
                     More than 100000           10.0%              15.0%
                     Write a Java program based on the above criteria to input the name, address, amount of purchase and the type of purchase (L for
                    Laptop and D for Desktop) by a customer. Compute and print the net amount to be paid by a customer along with his name and
                    address.
                     [Hint: Discount = (discount rate/100) * amount of purchase; Net amount = amount of purchase – discount]
                  8.  Write a menu-driven class in Java to accept a number from the user and check whether it is a neon number or a palindrome number.
                    [Hint:  (a) A number is a neon number whose sum of the square is equal to the number itself, e.g., 9 (square of 9 = 81 = 8+1 = 9).  (b) A
                    number is a palindrome number that when read in reverse order is the same as read in the right order, e.g., 44, 404, 1221, etc.]
                  9.  Write a menu-driven program in Java to accept the choice from the user to do the following:
                    (a)  accept a number and check whether it is an Automorphic number or not
                     (b)  accept any two numbers and print their GCD.
                     [Hint: (a)   An Automorphic number is a number whose square “ends” in the same digits as the number itself, e.g., 5*5 = 25, 6*6 = 36,
                            25*25 = 625.
                         (b)   GCD (Greatest Common Divisor) of two integers is calculated by the continued division method. Divide the larger number by
                            the smaller; the remainder then divides the previous divisor. The process is repeated until the remainder is zero. The divisor
                            then results in the GCD.]
                 10.  Write a Java program to print the following using a switch case.
                     a.  *****         b.  *
                        ****              * *
                         ***              * * *
                         ***              * * * *
                          **              * * * * *
                          *               * * * *
                                          * * *
                                          * *
                                          *


                212212  Touchpad Computer Science-XI
   209   210   211   212   213   214   215   216   217   218   219