Hey guys I want a little help of yours. I am writing a program and I want to restrict its answer to a certain decimal places. (two decimal places) Her is my program,
Code:
/* To create a bank application capable of finding an interest */ class bank { public void enter ( double principal , double rate_of_interest , double time ) { double SI = (principal * rate_of_interest * time) / (100.0); double A = principal + SI; double CItemp1 = (1+ (rate_of_interest/100.0)); double CItemp2 = Math.pow( CItemp1 , time); double CItemp3 = principal * CItemp2; double CI = CItemp3 - principal; System.out.println("The amount obtained after calculating simple interest is " + A); System.out.println("The Simple Interest for the required sum is Rs " + SI); System.out.println("The amount obtained after calculating compound interest is " + CItemp3); System.out.println("The Compound Interest for the required sum is Rs " + CI); } }
Comment