refactor the printInventory function