Q:

Java - Interface

0

This Program is used to demonstrate the interface concept.

All Answers

need an explanation for this answer? contact us directly to get an explanation for this answer

interface account

 {

   double saving(double ibala);

   double deposit(double amount);

   double withdraw(double amount);

 }

class emp implements account

 {  

   double bala1=0;

   double depo1=0;

   double withd1=0;

   public double saving(double ibala)

    {

     bala1 = ibala;

     return(bala1);

    } 

   public double deposit(double amount)

    {

       depo1 = bala1 + amount; 

      return(depo1);

    }

   public double withdraw(double amount)

    {

      withd1 = bala1 - amount;

      return(withd1);

    }



   public double balance()

    {

      return(depo1 - withd1);

    }

 }

 class empaccount1

 {

   public static void main(String arg[])

    {

      emp e = new emp();

      account aa;

      aa = e;

      System.out.println("Saving Account is : "+e.saving(1000)); 

      System.out.println("Deposit Amount is : " +e.deposit(500));

      System.out.println("Withdraw Amount is : " +e.withdraw(300));

      System.out.println("Balance Amount is : "+e.balance());

    }

 }

need an explanation for this answer? contact us directly to get an explanation for this answer

total answers (1)

Similar questions


need a help?


find thousands of online teachers now