Hi there,

Im studying computer science I have a project due tomorrow and I cant decide how to design it (using c#):

The project is fairly basic - I have a car and I am guiding it through a city. Basically the program takes a numbe of inputs via the console the first set of inputs determines the boundary of the driveable area (so you cant drive into the river), the second determines where to start at the direction you are facing (e.g x,y,North) and the last the directions which is a string of chars (e.g. LLFFRRFFFLFRM) where l means turn left, r means turn right and f means go forward.

Ive gone about and created a Car class and used the main class to control it.

What I cant figure out is should I check each char in the directoin string before passing it to the car class or should that be the responsibility of the car class.

And should the main class also make sure that the car does not go out of bounds or is that the responsibility of the car class as well.

How would you go about it and why?

Thanks in advance.

11 Years
Discussion Span
Last Post by Rashakil Fol

Who cares? Both ways are perfectly fine. If you want your cars to be smart enough to understand direction strings, that works as well as having them be dumb. You've got to put the intelligence somewhere.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.