I've been looking through the forum to find an exact answer to this, but have been unable to do so. Here is my code:
String item = String.format("%-6s $%-6.2f Number in Inventory: %-3d", this.getBarcode(), this.getPrice(), this.getInventory());
The output looks like this for two items put in:
DR4423 $700.04 Number in Inventory: 24
LD342 $1234.24 Number in Inventory: 425
The output should look like this, with an extra character space in the price for Number in Inventory to line up:
DR4423 $ 700.04 Number in Inventory: 24
LD342 $1234.24 Number in Inventory: 425
How do I make the "Number in Inventory" line up? It looks like the first item in the example lost an empty character space as it only has 5 digits instead of 6 for the price. Thanks in advance for the help.