Advertisement
Guest User

Untitled

a guest
Jun 18th, 2019
65
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.47 KB | None | 0 0
  1. // TODO: P05 Task 3 - Write code here to displays all items from the ArrayList of Item objects
  2. // passed to it.
  3.  
  4. itemList = load();
  5.  
  6. String output = String.format("%-20s %-10sn", "ITEM", "PRICE");
  7.  
  8. for (Item i : itemList) {
  9. String a = String.format("%s", i.getType().toUpperCase().split(""));
  10.  
  11.  
  12. output += String.format("%-20s %-10.2fn", a.concat(i.getType().substring(1).toLowerCase() ), i.getPrice());
  13.  
  14. }
  15. System.out.println(output);
  16. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement