because it just currently does not take a parameter?
I didn't have it set up to take any, wasn't quite sure in depth what would all have to be changed to allow this. Also, the instructor, when I mentioned this thought it was a good idea but she also I don't believe was sure on how this could be changed or didn't look into it any further. There were no definitions of this not being allowed for the assignment. The initial instructions are open for uniqueness.
Basically what she does want is 4 classes;
- Grocery - to have gets and sets, constructors.
- Glist - constructors, methods to insert, print list by item(use recursion), print list by aisle(need to sort first)
- InvalidAisleException - to catch invalid aisles.
- Testing class - to create the list, read items from file and add to the list, print by item(as read in from file), print by aisle, then print again by item to verify that it was sorted.
I took it on my self to try to get it to sort the list alpha. It is not a requirement. She explained that the last print was not intended to actually sort it alpha. She claimed that it was only intended to show that the list did resort the list items after running a sort and printing by aisle.
Example of a print out would be:
Enter the input file name: C:\\TestFile4.txt
bread is a duplicated item.
soup is a duplicated item.
The file C:\\TestFile4.txt contains the following items:
milk in aisle 1
bread in aisle 2
eggs in aisle 1
cheese in aisle 1
cream in aisle 1
soup in aisle 5
ketchup in aisle 5
yogurt in aisle 1
The list print by aisle is:
Aisle: 1
milk
eggs
cheese
cream
yogurt
Aisle: 2
bread
Aisle: 5
soup
ketchup
The list printed by item is:
milk in aisle 1
eggs in aisle 1
cheese in aisle 1
cream in aisle 1
yogurt in aisle 1
bread in aisle 2
soup in aisle 5
ketchup in aisle 5
But I was trying to get the last portion to print as such:
The list printed by item is:
bread in aisle 2
cheese in aisle 1
cream in aisle 1
eggs in aisle 1
ketchup in aisle 5
milk in aisle 1
soup in aisle 5
yogurt in aisle 1
And I was merely interested if there was a way that it could have been incorporated to work in such a way. I think it is a good way to learn new things by experimenting.