2014-02-25, 07:00 PM
Okay, there are 8 booleans and 1 char.
So you need to have a few objects:
A minivan object which HAS A:
- driver door (Door class)
- passenger door (Door class)
- left sliding door (Sidedoor class - subclass of a Door)
- right sliding door (Sidedoor class - subclass of a Door)
The minivan object HAS A constructor which you pass the initial string to. The constructor parses this information and sets the state of the minivan.
Then, in the minivan, you can ask it questions:
So you can fetch state from these objects.
It will be a lot of methods and classes, but it should all be fairly logical.
So you need to have a few objects:
A minivan object which HAS A:
- driver door (Door class)
- passenger door (Door class)
- left sliding door (Sidedoor class - subclass of a Door)
- right sliding door (Sidedoor class - subclass of a Door)
The minivan object HAS A constructor which you pass the initial string to. The constructor parses this information and sets the state of the minivan.
Then, in the minivan, you can ask it questions:
Code:
if(minivan.canOpenLeftSlidingDoor())
{
}So you can fetch state from these objects.
It will be a lot of methods and classes, but it should all be fairly logical.
