URGENT - Format a double?
ok its 1:36AM and ive got to finish this last tiny thing.
So ive done the calculations, now the times are 9AM - 5PM where u enter an int in the apropreite time/day.
Clicking calculate will show the weekly average which is a double
When im finding the average of all the weekly averages put together it displays for example:
13.666666666666666
how do i format it to only show 13.6 ?
code:
Code :
// WEEK ROW 10 AVERAGE
double totalJ = weekA + weekB + weekC + weekD + weekE + weekF + weekG + weekH + weekI;
txtBox[69].setText(Double.toString(totalJ));
// WEEK ROW 11 AVERAGE
double doubleK = totalJ / 9;
txtBox[76].setText(Double.toString(doubleK));
ok thanks
Re: URGENT - Format a double?
meh fixed it :D the fix for this was:
Code :
// WEEK ROW 11 AVERAGE
double doubleK = totalJ / 9;
DecimalFormat decimalFormat = new DecimalFormat("#.##");
txtBox[76].setText(decimalFormat.format(doubleK));
Thread marked as solved.