Computer Science, asked by jiya6666, 1 year ago

.......!!!!!!????????

Attachments:

Answers

Answered by RohitSaketi
5
package jiyaa;
import javax.swing.Spring;
public class BankofIndia {
public String name;
public int term;
public int age;
public int amount;
public BankofIndia(String name, int term, int age, int amount) {
super();
this.name = name;
this.term = term;
this.age = age;
this.amount = amount;
}
public void display()
{
float intrest=0;
if(this.age>=60)
{
if(this.term<=1)
{
intrest = (this.amount*8)/100;
}
else if(this.term>1 && this.term<=2)
{
intrest = (this.amount*9)/100;
}
else if(this.term>2 && this.term<=3)
{
intrest = (this.amount*10)/100;
}
else if(this.term>3)
{
intrest = (this.amount*11)/100;
}
}
else
{
if(this.term<=1)
{
intrest = (float) ((this.amount*7.5)/100);
}
else if(this.term>1 && this.term<=2)
{
intrest = (float) ((this.amount*8.5)/100);
}
else if(this.term>2 && this.term<=3)
{
intrest = (float) ((this.amount*9.5)/100);
}
else if(this.term>3)
{
intrest = (this.amount*10)/100;
}
}
System.out.println(this.name+" "+this.term+" "+this.age+" "+intrest+" "+this.amount);
}
public static void main(String[] args) {
BankofIndia obj1=new BankofIndia("bk", 2, 50, 12000);
BankofIndia obj2=new BankofIndia("bk1", 3, 61, 50000);
BankofIndia obj3=new BankofIndia("bk2", 2, 62, 40000);
System.out.println("NAME term age intrest earned amountPaid ");
obj1.display();
obj2.display();
obj3.display();
}
}

RohitSaketi: happy?
jiya6666: :) :)
RohitSaketi: :)
Similar questions