/* 9/13/2017 * This program illustrates named constant -- use the final * keyword. * Also discusses scope of variable -- (def) where in a pgm * a variable is "visible" i.e. can be accessed */ /** * This class calculates the interest earned in the past * month for a balance in a bank account. */ public class BankAccount { /** main method calculates and prints interest */ public static void main(String[] args) { // 1.27% is the interest earned final double INTEREST = 0.0127; double balance=900; System.out.println("balance in your account is: " + balance); //double balance = 1000; // cannot define balance again within // this scope which is the main method double interest = balance * INTEREST; System.out.println("Interest earned is: " + interest); } }