0

Hello all So I'm trying to print out some data here but my spacings a bit off, first ill post my code.

System.out.println("Vehicle ID     Rental Profit      Valuation");
      for (int x = 0; x < 9; x++) {
      System.out.print(Fleet[x].getVehicleID());
      System.out.printf("%17d",  Fleet[x].RentalProfit());
      System.out.println("   "  + Fleet[x].Valuation());

This is the piece of code that doesn't a formatting and it gives me the result of :

Vehicle ID     Rental Profit      Valuation
8675309              975          51300
5230532              810          51800
2039545             2116          52300
3             3875       30153500
2             2525       20152100
1             1609       10152900

I was just wondering how Can I get all of the rental profits/valuations all lined in instead of being 7 characters behind because the first 3 vehicle id's are so big.

jason
  • 11

0 Answers0