Back to: Java Program’s
0
public class ConstOverloadingSI
{
float rate,princi,years,interest;
public ConstOverloadingSI()
{
rate=5.0f;
princi=1000.0f;
years=1.0f;
}
public ConstOverloadingSI(float r)
{
rate=r;
princi=7000.0f;
years=2.0f;
}
public ConstOverloadingSI(float p,float y)
{
princi=p;
years=y;
rate=9.0f;
}
public static void main()
{
ConstOverloadingSI cosi1=new ConstOverloadingSI();
ConstOverloadingSI cosi2=new ConstOverloadingSI(2.0f);
ConstOverloadingSI cosi3=new ConstOverloadingSI(15000.0f,2.0f);
cosi2.Cal(cosi1);
cosi2.Cal(cosi2);
cosi2.Cal(cosi3);
}
public void Cal(ConstOverloadingSI cosi)
{
interest=(cosi.rate*cosi.princi*cosi.years)/100.0f;
System.out.println("~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~");
System.out.println("Rate of interest:"+cosi.rate);
System.out.println("Principal amount :"+cosi.princi);
System.out.println("Years:"+cosi.years);
System.out.println("Interest:"+interest);
System.out.println("Amount:"+(cosi.princi+interest));
}
}
Submitted By: Ms. Suchetana Mukherjee
If this program was helpful to you, do leave a comment.
All Creadit goes to Ms. Suchetana Mukherjee
P.N. : All the post on this website are for demonstration and education purpose only.
Student should perform all the practicals for there personal copies.