I need to make the output in 3 lines and also aligned by ":", using JOptionPane.showdialogmessage(): *note the alignment of the ":"
Total cost : $11175.00
Number of units : 500
Cost per unit : $22.35
I have tried manually adding spaces before each ":" but still these 3 lines do not strictly align:
String output = String.format("Total manufacturing cost :$%.2f\n", manufactCost) +
String.format("Number of units manufactured : $%d\n", numManufacted) +
String.format("Cost per unit : $%.2f\n", unitCost);
JOptionPane.showMessageDialog(null, output);
Here is the output screenshot:
What is the easiest way to realize this alignment? Thanks
P.S.: This is my first post. Sorry, I am still struggling with how to edit the post in a way that shows you the correct format of the output...I have been driven crazy by formatting... so I just post the screenshots instead... lol

