Page 249 - Cs_withBlue_J_C11_Flipbook
P. 249

39              ob.input();
                  40              char c; int amt;

                  41              System.out.println("Enter (D)eposit/(W)ithdraw:");
                  42              c=sc.next().charAt(0);

                  43              if(c=='D')    {
                  44                  System.out.println("Enter the amount to deposit:");

                  45                  amt=sc.nextInt();
                  46                  ob.deposit(amt);
                  47              }

                  48              else if(c=='W')    {

                  49                  System.out.println("Enter the amount to withdraw:");
                  50                  amt=sc.nextInt();
                  51                  ob.withdraw(amt);

                  52              }
                  53              else

                  54                  System.out.println("Invalid input");
                  55              ob.print();

                  56          }
                  57      }

                 The output of the preceding program is as follows:
                   Enter Name of Customer : Ajay
                   Enter account number of Customer : 20102
                   Enter type of account of Customer : s
                   Enter the balance amount in the account (minimum amount 1000/-) : 3000
                   Enter (D)eposit/(W)ithdraw:
                   D
                   Enter the amount to deposit:
                   2000

                   Customer Name:Ajay
                   Account No.:20102
                   Balance:5000
                   Type of Account:s














                                                                                                                       247
                                                                                              Methods and Constructors  247
   244   245   246   247   248   249   250   251   252   253   254