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.

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.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.