i1=(1 + (rate/1200)); //i1,i2,13,14 are used to simplify the formula i2=-(term*12); i3=Math.pow(i1,i2); i4=1-i3; monthlyPayment=interest/i4; principalPaid=monthlyPayment-interest; System.out.print("Loan amount: " +decimalAmount.format(loanAmount)+ "\n"); System.out.println("Monthly payment is: " +decimalAmount.format(monthlyPayment)); System.out.println(""); System.out.print("Month\tInterest Paid\tLoan Balance \n");
term=term*12; //multiply the input year with 12 so that we would get the corresponding months
if (term % 12 == 0) //year by year display { try { BufferedReader in = new BufferedReader(new InputStreamReader(System.in)); System.out.print("Press enter to list upcoming 12 payment details"); in.read(); } catch (IOException e) {} }
You may also want to google a Swing Tutorial. Just glancing over your program you might want to concentrate particularly on JTextField, JButton and possibly JTextArea. You may also want to look at LayoutManagers (in this case probably GridLayout and BorderLayout).
you can infact put all you calculations into a Method and call that Method in an infinite loop , after each processing ask the use to enter Q for quit and in the method make a check each time you proceed and if user enters Q then exit the system.