while Investment

while Investment - //update the balance...

Info iconThis preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
/** * * @author Manuel Duenas */ public class WhileInvestment { /** * */ public static void main(String[] args) { // TODO code application logic here //declaration final double RATE = 10; final double TARGET_BALANCE = 20000; //initialization double balance = 10000; int year = 0; //while loop while ( balance < TARGET_BALANCE)//condition { year = + 1; balance = balance * (1 + RATE/100);
Background image of page 1
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: //update the balance System.out.printf(&quot;on year: %5d your balance should be: $%,.2f\n&quot;, year, balance); }//end of the loop //output System.out.println(&quot;the year you should take your money out is year:&quot; + year); System.out.printf(&quot;your balance should be: $%,.2f\n&quot;, balance); //print System.out.println(year); } }...
View Full Document

Ask a homework question - tutors are online