I am trying to decimal format a group of numbers into a 2D array and I keep getting an Error in Netbeans. It says where I have the d.format(0.0); that I need a double and have a String when then input present is 0.0. This is driving me insane and I have tried parsing just to try something and hasn't worked.
NumberFormat d = new DecimalFormat("#0.00");
String [] counties = {"Broward", "Miami-Dade", "Palm Beach", "Average"};
String [] petrol_type = {"Regular", "Plus-2", "Supreme", "Diesel","Average"};
double [][] array = new double[5][4];
public PetrolPrice (double [][] p)
{
for (int i = 0; i < 5; i++)
{
for(int j = 0; j < 4; j++)
{
array[i][j] = d.format(0.0);
}
}
for (int i = 0; i < 4; i++)
{
for(int j = 0; j < 3; j++)
{
array[i][j] = p[i][j];
}
}
}