/* * This class calculates simple interest and total amount owed, given a starting amount, time period of loan and rate of interest. */ class Interest { public static void main (String [] args) { //decalre variables for starting amount, time and rate of interest, and assign values to them. double principal = 2700.0; int years = 3; double rate = 11; //calculate interest and total amount double interest = principal * years * rate; interest /= 100; // same as interest = interest / 100; double totalAmount = principal + interest; //print the result System.out.println("Total owed : " + totalAmount); } }