# Bank – Abstract concept Program in java

In this post, we will learn Bank – Abstract concept Program in java Programming language.

## Question:

Banks are supposed to implement their own method that returns back the rate of interest for personal loans. To implement this scenario in SBI and PNB banks they are supposed to extend the Bank class provided by the RBI that has a single abstract method called getRateOfInterest() that returns back an integer.

Develop an automated module wherein the banks SBI and PNB that have their own classes as SBI and PNB that extend from the BANK class and implements the abstract method.

The current rate of interest provided by SBI is 7% and that of PNB is 8 %

Implement the above scenario.

Sample Input and Output

Rate of Interest in SBI is: 7 %

Rate of Interest in PNB is : 8 %

### CODE:–

```public class TestBank{
public static void main (String[] args) {
Bank s=new SBI();
Bank p=new PNB();
System.out.println("Rate of Interest in SBI is: "+s.getRateOfInterest()+" %");
System.out.println("Rate of Interest in PNB is: "+p.getRateOfInterest()+" %");
}
}```
```public class Student
{
private int id;
private String name;
private int[] marks;
private float average;
public void setId(int id)
{
this.id=id;
}
public int getId()
{
return this.id;
}
public void setName(String name)
{
this.name=name;
}
public String getName()
{
return this.name;
}
public void setMarks(int[] marks)
{
this.marks=marks;
}
public int[] getMarks()
{
return this.marks;
}
public void calculateAvg()
{   float sum=0;
for(int i=0;i<this.marks.length;i++)
{
sum+=this.marks[i];
}
average=(float)(sum/(this.marks.length));
setAverage(average);
}
{int flag=0;
for(int i=0;i<this.marks.length;i++)
{
if(this.marks[i]<50)
{
flag++;
}
}
if(flag>0)
{
}
else
{
if(this.average>=80 && this.average<=100)
{
}
else if(this.average>=50 && this.average<=79)
{
}
else
{
}
}
}
public void setAverage(float average)
{
this.average=average;
}