2014-02-25, 06:43 PM
Hi all~
I'm having a little trouble coming up with a program for this problem I was assigned. Here is the problem:
A minivan has two sliding doors. Each door can be opened by either a dashboard switch, its inside handle or its outside handle. However, the inside handles do not work if a child lock switch is activated, in order for the sliding doors to open, the gear shift must be in park and the master unlock switch must be activated.
Your task is to simulate a portion of the control software for the vehicle. The input is a sequence of values for the switches and the gear shift, in the following order:
- Dashboard switches for left and right sliding door, child lock and mast lock (0 for off and 1 for activated).
- Inside and outside hands on the left and right doors (1 and 0).
- The gear shift setting (one of P N D 1 2 3 R).
Typical input would be 0 0 0 1 0 1 0 0 P
Print Left door opens and/or right door opens as appropriate. If neither door opens, print both doors stay closed.
So far I have asked for input for the nine boolean things. I'm having trouble coming up with some if and if/else statements. It's quite tough to organize all these combinations and stuff. Anyway, any help would be much appreciated!
Also, sorry for the block of text
I'm having a little trouble coming up with a program for this problem I was assigned. Here is the problem:
A minivan has two sliding doors. Each door can be opened by either a dashboard switch, its inside handle or its outside handle. However, the inside handles do not work if a child lock switch is activated, in order for the sliding doors to open, the gear shift must be in park and the master unlock switch must be activated.
Your task is to simulate a portion of the control software for the vehicle. The input is a sequence of values for the switches and the gear shift, in the following order:
- Dashboard switches for left and right sliding door, child lock and mast lock (0 for off and 1 for activated).
- Inside and outside hands on the left and right doors (1 and 0).
- The gear shift setting (one of P N D 1 2 3 R).
Typical input would be 0 0 0 1 0 1 0 0 P
Print Left door opens and/or right door opens as appropriate. If neither door opens, print both doors stay closed.
So far I have asked for input for the nine boolean things. I'm having trouble coming up with some if and if/else statements. It's quite tough to organize all these combinations and stuff. Anyway, any help would be much appreciated!
Also, sorry for the block of text

