The customer list class was modified to initialize the head pointer to null in the constructor and delete it in the destructor. The printStoresInfo function was updated to iterate through the linked list by accessing each node's printStoreInfo method rather than its next pointer. These changes address the error caused by an uninitialized head pointer and allow the stores information to be properly printed.
14. Store s1(123, "KS Stores", "Wells Street", "New York", "New York", "A50032");
Store s2(124, "Free Stores", "Wall Street", "New York", "New York", "A50032");
Store s3(125, "Real Stores", "KC Street", "Washington", "Washington D.C",
"D50032");
list.addStore(&s1);
list.addStore(&s2);
list.addStore(&s3);
list.removeStore(124);
list.printStoresInfo();
return 0;
}
OUTPUT:
=====================================================================
================
The List is currently empty.
=====================================================================
================
123 KS Stores Wells Street New York, New York A50032
125 Real Stores KC Street Washington, Washington D.C D50032