0% found this document useful (0 votes)
4 views2 pages

Java Exp-5

The document presents a Java program that demonstrates multiple inheritance through interfaces and classes. It defines a Bank interface with a method and constants, a Customer class for customer details, and an Account class that extends Customer and implements Bank. The main method creates an Account object and calculates the interest based on the account balance and predefined rate and years.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
4 views2 pages

Java Exp-5

The document presents a Java program that demonstrates multiple inheritance through interfaces and classes. It defines a Bank interface with a method and constants, a Customer class for customer details, and an Account class that extends Customer and implements Bank. The main method creates an Account object and calculates the interest based on the account balance and predefined rate and years.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 2

// Prg.

Program to implement the Multiple Inheritance

import java.lang.*;

interface Bank

float rate = 12.0f;

int no_of_years=3;

void show();

} class
Customer {

String cust_name;

int cust_id;

Customer(String s,int i)

cust_name = s;

cust_id = i;

void display()

System.out.println("Customer Name = "+cust_name);

System.out.println("Customer Id = "+cust_id);

}
}
class Account extends Customer implements
Bank
{

int acc_no;

float acc_bal;
Account(String s,int

i,int n,float b)

super(s,i);

acc_no=n;

acc_bal=b;

public void show()

super.display();

System.out.println("Account No. = "+acc_no);

System.out.println("Account Balance = "+acc_bal);

void interest()

show();

float intr = (rate*acc_bal*no_of_years)/100;

System.out.println("Interest = "+intr);

}
} class Main3

{ public static void main (String[]

args)

{
Account ac = new
Account("Sameer",8008,123456,50000f);
ac.interest();

}
}

You might also like