import java.io.*; //Partial solution to the Lab class Account { // Name Ann Onymous // Does a simple Bank Account with compounding "race" private String identity ; private double balance ; private int number; private double rate ; /* Constructor*/ public Account (String i, double b) { // Does construct, create, initialize identity = i ; balance = b ; }//EndConstructor Account /* Constructor*/ public Account (String i, double b, int n, double r ) { // Does construct an account with 4 attributes identity = i ; balance = b ; number = n ; rate = r ; }//End Constructor2 Account /* Function*/ public double theBalance () { // Does return balance of Account return balance; }//EndFunction theBalance /* Routine*/ void compoundedBy (int n) { // Does compound the balance by n times while (n > 0) { balance = balance * rate + balance ; n--; }//endWhile }//endRoutine compoundedBy /* Routine */ public static void main (String[] args) throws IOException { Account first, second; // Does test class; finds when two balances meet! first = new Account ("Jack", 10000.00, 1234, 0.04); second = new Account ("Jill", 5000.00, 5678, 0.06); int years = 0; while ( first.theBalance() > second.theBalance() ) { first.compoundedBy (1); second.compoundedBy(1); years ++; }//endWhile System.out.println ("The duration is " + years ); }//EndRoutine main }//EndClass Account //Outputs: The duration is 37