Hi all, as the end of the year approaches, so does my programing project for college. it is a 4 part program and the first 3 parts went quite well. My only concern now is the last part. I feel like I missed the lecture day over some of this material because I have no clue what I need to do. I am a beginner at computer science but I am absolutely clueless on what I'm being asked to do. I'm not asking for a complete program that gives me the answer, but if someone can help me out in explaining what this stuff means then it would be greatly appreciated!!!
So here is the assignment:
Create an Indexed Linked-List structure for a collection of database Records. The index portion should be a string type.
Of course the record portion will be a Vendor type.
Your class should have the following methods:
1. BuildList which will read a record from a text file, insert index element node(if needed) and database recrod node.
2.InsertIndexNode
3.InsertRecordNode
4.GetVendorRecord given the VendorID
5. ListRecords for given a specific State.
6.ListAllRecords(in sorted order by State by Vendor)
Build your list from the file:: Vendor List File.txt in Handouts
(I wont bother posting the entire file because it has about 120 lines but it looks roughly like this.)
Vendor ID//// Vendor Name//// Vendor City//// Vendor State//// Zip Code
1.//// US postal service //// Madison //// WI //// 53707
2.//// Jobtrak//// Los Angeles//// CA//// 90025
3. //// ASC Signs//// Fresno//// CA //// 93703
and so on...
Specifically my big questions are:
1. What exactly is an indexed linked list? I've read some stuff online but it seems to be the same as a regular linked list.
2. What does it mean when it says the record portion will be a Vendor Type and that the index portion will be a string type?
3. What exactly is a "record" here?
I have a few more questions but I'd rather figure those out on my own. If you guys could help me out on these that would be greatly appreciated. Thanks in advance.
Your professor is asking you to create a database implemented as a linked list. So, the data portion of a linked list node is actually an entire database record.
A specific record in the database is identified, or indexed, by a string value. So, the nodes of the linked list have a string index value. The remainder of the data portion of the node is a Vendor Type, a structure or class that contains the data from the input file. Of course, the linked list node also contains a next pointer.
I'm guessing here, but it looks like step 6 wants you to do the following:
1. Put either the State or Vendor ID into the index field, depending on what was selected
2. Sort the linked list by the index field values
3. Print out the list.
mostly yes it does, except the Vendor type part. In my vendor class I have...
//header file
class Vendor
{
private:
struct node
{
node* next;
string ID;
string name;
string city;
string state;
int zipCode;
};
};
but then the data would be strings and and int, and not a vendor type. How would I store the data, in the node, as a vendor type?
Close. You have the node as being part of the vendor. It is actually the other way around. I think you want something along the lines of:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
class Vendor
{
string ID;
string name;
string city;
string state;
int zipcode;
};
class Node
{
string index;
Vendor theVendor;
Node* next;
};
Edit: By the way, you might want to check on what is meant by step 6. It might mean to sort by state, and then sort every vendor in each state by vendor ID. That would be different from what I told you above. I can't tell you what your professor wants.