I'm having a hard time getting a decimal format with currency added to my String. I've created a table with columns and rows that calculates through a while, for, and do while loop. I use table as my string to show my results. which displays my results. I'm trying to get it to format to ("$0.00"); for the whole table.
Any suggestions? I'm very new at coding so I apologize if this isn't enough information.
String result = String.format("$0.00");
System.out.println(table);
An example of my Do While Loop.
int col;
int row = 0;
double tempRate = startingRate;
double header;
double sideHeader;
table = "";
for (header = 0; header < tableSize; header++) {
table += " " + startingRate;
startingRate += 0.05;
}
startingRate = tempRate;
table += "\n";
do {
col = 0;
startingRate = tempRate;
sideHeader = 0;
table += startingAmount + " ";
do {
table=table + (startingAmount -(startingRate * startingAmount)) + " ";
startingRate+= .05;
col++;
} while (col < tableSize);
startingAmount+= 0.50;
row++;
table+= "\n";
} while (row < tableSize);
sideHeader++;