So, i have to methods in a non main class and i need to figure out how to print both the println in a chart with two columns
should look something like this
x : y
x : y
x : y
x : y
x : y
but instead i print like this
x
x
x
x
x
y
y
y
y
y
this is my code , any help would be appreciated
/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
/**
*
* @author vazquez
*/
import java.util.Date;
import java.util.Calendar;
import java.text.DateFormat;
import java.text.NumberFormat;
public class RetiermentCalculator
{
AccountInformation[] years = new AccountInformation[35];
public RetiermentCalculator(int aYear, double aBeginIncome, double aContribution, double aReturn )
{
double answer = 0.0;
double finance = (aBeginIncome + aContribution);
double intrestMade = finance * aReturn;
for (int index = 0; index < years.length; index ++)
{
answer += finance + intrestMade;
NumberFormat nf = NumberFormat.getCurrencyInstance();
System.out.println(nf.format(answer));
}
}
@Override
public String toString()//@override
{
String answer = "";
Calendar greg = Calendar.getInstance();
greg.set( 2010, Calendar.DECEMBER, 31);
DateFormat formatter = DateFormat.getDateInstance();
for(int index = 0 ; index < years.length ; index ++)
{
greg.add(Calendar.YEAR, 1);
Date gregsTime = greg.getTime();
System.out.println(formatter.format(greg.getTime()));
}
return(answer);
}
}