im having a problem while try to output data to a file. it keeps throwing "java.util.IllegalFormatConversionException"
this the part with the problem
try{
out = new Formatter("allaccounts.txt");
}
catch(FileNotFoundException ex){
System.err.println("Error: File not Found!");
System.exit(1);
return;
}
for(int i = 0; i < start.getnumAcc();i++)
{
outs.format("%d ",users[i].getNum());
outs.format("%s ",users[i].getName());
outs.format("%s ",users[i].getPass());
outs.format("%d\n",users[i].getBalan()); //returns double- line that throws the exception
}
outs.close();
when i googled it i found out it the %d should be a %f. but when i do that the data gets written all wrong.
for example, if users.getBalan() returns 123.45 it would be instead write 123.450000 to it.