I am trying to format a string whereby the '$' stick close to the price.
For example:
Oranges 3 $3.00 $9.00
But what I currently have:
Oranges 3 $ 3.00 $ 9.00
This is my code: (Note: "price" and "total" are double datatype)
System.out.printf("%-25s %10s $%10s $%10s", item, quantity, price, total);
I want to have a gap in between every output but I can't find a way to get the result that I wanted. Is there any ways to solve this?