Here is my code:
System.out.printf("\n%-10s%9s%11s%13s%9s\n",
"yearBuilt","area(sqf)","price","replaceRoof","sqfPrice");
System.out.printf("\n%-10d%9.1f$%11.2f%13s$%8.2f\n",
house1.getYear(),house1.getSquareFeet(),house1.getPrice(),house1.isRoofChangeNeeded(),house1.calcPricePerSqf());
And here is the output I'm getting:
yearBuilt area(sqf) price replaceRoof sqfPrice
1996 2395.0$ 195000.00 true$ 81.42
This is the output I want:
yearBuilt area(sqf) price replaceRoof sqfPrice
1996 2395.0 $195000.00 true $81.42
I tried using DecimalFormat but for some reason it didn't seem to work correctly when using it inside printf, when it worked normally in another area of my program. Any ideas on how to fix this?
NumberFormat's predefined formats.