Page 480 - CA_Blue( J )_Class10
P. 480

4          String cusname;                         //Instance Variable
                 5          long mobile;

                 6          double price,dis,bill;
                 7          static int count;                               // Class Variable

                 8          departmental_shop()                         // Non-Parameterized constructor

                 9          {
                10              cusname="";
                11              mobile=0;

                12              price =0.0;
                13              dis=0.0;

                14              bill = 0.0;
                15          }

                16          departmental_shop(String cn, long m, double p)  //Parameterized Constructor
                17          {

                18              cusname=cn;
                19              mobile=m;

                20              price = p;
                21              dis=0.0;

                22              bill = 0.0;
                23          }

                24          public static void countobject()                // Static method to increase
                           value of class variable
                25          {
                26              count=count+1;

                27          }

                28
                29          void input()                                    // Input method to accept value
                30          {

                31              Scanner sc = new Scanner(System.in);
                32              System.out.println("Enter name , mobno and cost");

                33              cusname =sc.next();
                34              mobile=sc.nextLong();

                35              price =sc.nextDouble();
                36          }






                478478  Touchpad Computer Applications-X
   475   476   477   478   479   480   481   482   483   484   485