Thanks.
1 reply to this topic
#1
Posted 12 September 2011 - 01:56 AM
Hey, I just need help with a data structures and algorithms assignment. I've done quite a bit of it and have attatched my solution in this thread. I have also attatched the assignment question sheet. I would just like someone to let me know if there are any mistakes or improvements needed.
Thanks.
Thanks.
|
|
|
#2
Posted 13 September 2011 - 04:43 AM
General observations on opening the project:
1) ProgramFunctions.h doesn't have header guards.
2) it seems odd that you're using structs instead of classes, especially since some of your structs have constructors as well.
3) Looking at ProgramFunctions.cpp, I would review a number of those functions to see which ones can be included in various classes. For example, assignRandomCarriageID seems like it should be a private method of Train.
4) Train.getTrain: returning a reference to a private member makes the private member NOT private. Identify the functions that need it and make them methods of Train.
5) Carriage: it seems weird that you don't have an overloaded constructor that allows you to set the CarriageID as part of the constructor.
6) You have a few functions that seem really questionable. What is the purpose of printHowManyCarriages? It is only called in one place, contains only one line of code, and obfuscates what's happening in getCarriageCount. It looks like it's a function created for the sake of having a function.
I don't think there's anything inherently bad in what you've done, and it looks like it will probably work (I haven't tested it). It does look like it could be cleaned up a lot, though.
1) ProgramFunctions.h doesn't have header guards.
2) it seems odd that you're using structs instead of classes, especially since some of your structs have constructors as well.
3) Looking at ProgramFunctions.cpp, I would review a number of those functions to see which ones can be included in various classes. For example, assignRandomCarriageID seems like it should be a private method of Train.
4) Train.getTrain: returning a reference to a private member makes the private member NOT private. Identify the functions that need it and make them methods of Train.
5) Carriage: it seems weird that you don't have an overloaded constructor that allows you to set the CarriageID as part of the constructor.
6) You have a few functions that seem really questionable. What is the purpose of printHowManyCarriages? It is only called in one place, contains only one line of code, and obfuscates what's happening in getCarriageCount. It looks like it's a function created for the sake of having a function.
I don't think there's anything inherently bad in what you've done, and it looks like it will probably work (I haven't tested it). It does look like it could be cleaned up a lot, though.
1 user(s) are reading this topic
0 members, 1 guests, 0 anonymous users


Sign In
Create Account



Back to top









