Java

Java - Interface

Java - Interface
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());

    }

 }
Senthilvelan Sambamoorthy

Senthilvelan Sambamoorthy is working as a Professor in Department of Master of Computer Applications, Paavai Engineering College, Namakkal, Tamilnadu, India, He is Masters in Computers Applications. Having 18+ years of experience and his area of interest is Java, JSP, Servlet, J2EE, C#, PHP, Python ASP.NET, SQL Server and etc.