my mind must be in a blank, i cant make sense of this
hi
i have a method that gets information from methods in its own class, 'builds' a string and displays the string when the method is called from another class, however the displaying bit isnt happening when i call the method, can some one see y? ill post the different ways i have tried the method:
//tried this....
public String toString ()
{
//method to create a string for displaying client info
String display;
display ="name: "+getName()+"\n"+
"Resident: "+getResident()+"\n"+
"Gross Salary (per week):%.2f %n "+getWeeklyGrossSalary()+"\n"+
"Net Salary (per week):%.2f %n "+getWeeklyNetSalary()+"\n"+
"tax (per week):%.2f %n "+getWeeklyTax()+"\n"+
"medicare (per week):%.2f %n "+getWeeklyMedicare()+"\n"+
"Expenses:%.2f %n "+getWeeklyExpenses();
return System.out.print(display);
}
//and this....
public String toString ()
{
//method to create a string for displaying client info
String display;
display ="name: "+getName()+"\n"+
"Resident: "+getResident()+"\n"+
"Gross Salary (per week):%.2f %n "+getWeeklyGrossSalary()+"\n"+
"Net Salary (per week):%.2f %n "+getWeeklyNetSalary()+"\n"+
"tax (per week):%.2f %n "+getWeeklyTax()+"\n"+
"medicare (per week):%.2f %n "+getWeeklyMedicare()+"\n"+
"Expenses:%.2f %n "+getWeeklyExpenses();
return display;
}
// am calling the method like this...
c[poss].toString();//<--'c' is an array of 'client' objects
much cheers for any assistance
Marc

