I have made a mistake and I am hoping someone here can bail me out. I need to turn the code below into a GUI interface and quick. TIA please help\
Code:
//Noah Fenley
//POS406 week 4 personal assignment
//
//
import java.text.*;
public class week5
{//open
public static void main(String[] args)
{//open
wk5ClassSupport[] scenarios;//create array
scenarios = new wk5ClassSupport[3];
for (int x=0; x < 3; x++)//avoid empty statement
scenarios[x] = new wk5ClassSupport();
//array values
scenarios[0].setyears(7);
scenarios[1].setyears(15);
scenarios[2].setyears(30);
scenarios[0].setRate(5.35);
scenarios[1].setRate(5.5);
scenarios[2].setRate(5.75);
for (int x=0;x<3;x++)//enter loan amount for each loan array
scenarios[x].setLoan(200000.00);
for (int x =0; x<3; x++)
{//display after calculations--Open
scenarios[x].calculateDisplay();//run the calculate section of wk3Class
System.out.println("-------------------------------------------------");
}//Close
}//Close
}//close
And the support class
//Noah Fenley
//Some of the code from week 3 has been commented out. I prefer to keep the code intact
//just in case I need to return to it for reference.
import java.text.*;
public class wk5ClassSupport {//open
//public static void main(String[] args)throws InterruptedException {
//Constants
private double Loan; // Loan amount
private double Rate;
private int years;
// //Number of total payments 12 months X 30 years
public void setyears(int passedValue)//years to be passed from week4 class
{//open
years = passedValue;
}//close
public void setRate(double passedValue)//Rate to be passed
{//open
Rate = passedValue;
}//close
public void setLoan(double passedValue)//loan amount to be passed
{//open
Loan = passedValue;
}//close
public void calculateDisplay()//display to be passed
{//open
//Variables
double pymt = 0.0;
double intPymt = 0.0;// Interest payments initial value
double remainingBalance = Loan;
double prinPymt = 0.0;// Principle payment
//double mpr = Rate; //APR divided by 100 to get % then 12 for the months in a year
int pymtNum = years * 12;
double Apr = Rate/100/12;//useless now, but helped during debugging
int c = 0; // counter
DecimalFormat twoDecimalPlaces = new DecimalFormat("###,###,###.00");// formatter for printing
System.out.println("Amount Financed: $ " + twoDecimalPlaces.format(Loan));// Show The Loan Total
System.out.println("Total number of payments: " + years *12);// Show number of payments
pymt = Loan * (Math.pow(((1-(Math.pow((1 + Apr),-pymtNum)))/Apr), -1)); // Payment
System.out.println("Monthly Payment :$ " + twoDecimalPlaces.format(pymt));
System.out.println("Loan Term In Years:"+years );//Show laon years
System.out.println("APR: " + Rate + "%");// Show APR
//previous info not used in this class anymore.
//Thread.sleep(3000); //pause for 3 seconds
for (int x = 1; x < (pymtNum + 1); x++) {
intPymt = remainingBalance * Rate/100/12;//interest paid monthly
prinPymt = pymt - intPymt;//monthly principle
remainingBalance = remainingBalance - prinPymt;// remaining balance
c++; //display 12 payments
System.out.println("Payment" + x + "\t"+ "Interest Paid: $"+ twoDecimalPlaces.format(intPymt)+ "\tPrinciple: $" + twoDecimalPlaces.format(prinPymt)+ "\t Balance: $" + twoDecimalPlaces.format(remainingBalance));
if (c == 12) {//show 12 payments since there are 12 a year
//Thread.sleep(5000);//pause for 5 seconds
c = 0;
}
}
}
}

Signature
NGF74
Ben Aroia - 30 Apr 2004 13:19 GMT
> I have made a mistake and I am hoping someone here can bail me out. I
> need to turn the code below into a GUI interface and quick. TIA please
[quoted text clipped - 123 lines]
> }
> }
i didn't read all the code but do you want me to turn it into a gui
interface for you? or do you want me to offer sugestions? e-mail me
-Ben
Ben Aroia - 30 Apr 2004 13:24 GMT
> I have made a mistake and I am hoping someone here can bail me out. I
> need to turn the code below into a GUI interface and quick. TIA please
[quoted text clipped - 123 lines]
> }
> }
e-mail: changed: ben to jpro91021@mac.com
-Ben
Andrew Thompson - 30 Apr 2004 14:07 GMT
...
> e-mail: changed: ben to jpro91021@mac.....
> -Ben
That was very nice of you to offer to write
the OP's code for them. Could I ask you also
be nice to the rest of the members of the group
by trimming anything to which you are not directly
responding?
[ You just reposted around 260 lines,
simply to add 5. ]
Hoping you can see how trimming benefits all..

Signature
Andrew Thompson
http://www.PhySci.org/ Open-source software suite
http://www.PhySci.org/codes/ Web & IT Help
http://www.1point1C.org/ Science & Technology