Jump to content

Class Derivation Help

CJPowell27

Hey guys, I've been given a problem to work on object oriented programming and class derivations. the program I'm supposed to make is a public transport scheduling program. Heres some of the stuff I have to have and  I would like some ideas as to what classes you guys would suggest I do, I cannot seem to think of a good way to make classes without ruining the point of object oriented design. I don't want any code I'd just like some pointers for which classes to make. Any recommendations are very much appreciated.

Spoiler

1.Line–The information about a particular streetcar line. Each has a name,

a number of stops, and then a type (e.g.,some are loops

and others are lines (that go back and forth)

2. Streetcar–The particular information about a street car. Streetcars could have an identification number (e.g., Vehicle #S002) along with its current location and status (in

service or not).

3. Location–The location can only be on a route and going a particular direction (e.g.,

Route: A loop, Direction: A loop to Lloyd via Pearl, Closest Stop)

4. Stop A place where the Streetcar comes to a stop and lets in/off passengers

5. Pace- At any Stop, a streetcar should pause and not continue if it is within

N (e.g., 4) stops of another streetcar. The controller should be able to specify the spacing. For

example, at rush hour, there may be more streetcars in service

with a smaller/closer pace

Spoiler

1.Streetcar IS its location plus more

2.ALine IS its type

3.A Line can have multiple streetcars on it and at different locations

4.A direction is one of the different directions available based on its line

5.The Map has multiple lines

6.And more! Can you do something with Route or Stop? Remember, you need a total of at

least 5 classes

 

i5 4670k| Asrock H81M-ITX| EVGA Nex 650g| WD Black 500Gb| H100 with SP120s| ASUS Matrix 7970 Platinum (just sold)| Patriot Venom 1600Mhz 8Gb| Bitfenix Prodigy. Build log in progress 

Build Log here: http://linustechtips.com/main/topic/119926-yin-yang-prodigy-update-2-26-14/

Link to comment
Share on other sites

Link to post
Share on other sites

It seems to me that your Line class is the big player here.

Classes:

  • Linked List - Allows you to arrange things in linear order, inherited by Positional List
  • Positional List - Allows you to access the Linked List by a "Position Object". 
  • Stop - An object that holds a position.
  • Streetcar - Defines speed, capacity, holds a list of Stops and a Position Object
  • Line - The class that ties it all together. A Line holds streetcars.

This is kind of "cheating" your class count because you are creating the Linked List class only to facilitate a more readable Positional List class.

ENCRYPTION IS NOT A CRIME

Link to comment
Share on other sites

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×