Back To Java User Defined Methods Index
//program to create a function to calculate simple interest based on principal amount,rate of interest and time (principal,rate and time are passed to functions as arguments, principal and rate are passed as float arguments , time is passed as integer argument ) class si { public void csi(float principal,float rate,int time) { float si; si=(principal*rate*time)/100; System.out.println("simple interest is " + si); } } public class calcsi { public static void main(String[] args) { si ob=new si(); ob.csi(5000,5,10); } }