Page 606 - Computer science 868 Class 12
P. 606

14           }
                15       }

                16
                17       Codes for class Simple_Interest:-

                18
                19       class Simple_Interest extends Account

                20       {
                21       double rate,time;
                22       Simple_Interest(int a1,double b1,double r1,double t1) //Constructor

                23           {

                24       super(a1,b1);
                25       rate=r1;
                26       time=t1;

                27       }
                28       double Interest() //To find Simple Interest

                29       {
                30       double SI=0.0;

                31               SI=(principle*rate*time)/100;
                32       return SI;

                33       }
                34       void display() //To Display Info

                35       {
                36       super.display();

                37       System.out.println("The Rate of Interest is " + rate + "and Time is " + time);
                38           }

                39       }
                40       Codes for class Compound_Interest:-

                41
                42       class Compound_Interest extends Account

                43       {
                44       doubler ate,time;

                45       Compound_Interest(int a1,double b1,double r1,double t1)//Constructor
                46       {







                604604  Touchpad Computer Science-XII
   601   602   603   604   605   606   607   608   609   610   611