I am trying to align my output like this:
Full Name Total Sales
========= ===========
John Smith 619.50
Mary Willow 514.50
Sallie Smite 519.50
Tom Andrews 55.00
Norman Bates 366.00
Horace Williams 301.00
Anne Whitney 426.37
Wallie Jawie 647.00
Marie Bunker 63.00
Mopsie Bear 1582.00
Stephen Andrews 265.00
Stacie Andrea 265.00
Last Name 463.00
I am using this code but the alignment is always off
// For loop
System.out.printf("%s %s %.2f %n " , list[i].getFirstName() , list[i].getLastName(), list[i].getTotalSales() )
This is the result that I get. How can I get the total sales to be aligned? Also the second output has a space in front of the first name, How can I get rid of that?
Full Name Total Sales
========= ===========
John Smith 619.50
Mary Willow 514.50
Sallie Smite 519.50
Tom Andrews 55.00
Norman Bates 366.00
Horace Williams 301.00
Anne Whitney 426.37
Wallie Jawie 647.00
Marie Bunker 63.00
Mopsie Bear 1582.00
Stephen Andrews 265.00
Stacie Andrea 265.00
Last Name 463.00
trimit.