public void printList() { BackpackNode curr = head; while (curr != null) { Console.Write(" {0} ", curr.data.weaponName); curr = curr.next; } Console.WriteLine(); }
public void addLast(Weapon b) { BackpackNode newNode = new BackpackNode(b); if (head == null) { head = newNode; return; } BackpackNode curr = head; while (curr.next != null) { curr = curr.next; } curr.next = newNode; }
public BackpackNode(Weapon b) { data = b; next = null; }
public Backpack(double m) { head = null; maxWeight = m; presentWeight = 0; }