Page 225 - computer science (868) class 11
P. 225

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














                                                                                                                       223
                                                                                              Methods and Constructors  223
   220   221   222   223   224   225   226   227   228   229   230