Esempio n. 1
0
        public void printList()
        {
            BackpackNode curr = head;

            while (curr != null)
            {
                Console.Write(" {0} ", curr.data.weaponName);
                curr = curr.next;
            }
            Console.WriteLine();
        }
Esempio n. 2
0
        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;
        }
Esempio n. 3
0
 public BackpackNode(Weapon b)
 {
     data = b;
     next = null;
 }
Esempio n. 4
0
 public Backpack(double m)
 {
     head          = null;
     maxWeight     = m;
     presentWeight = 0;
 }