The car rental robot

Action functions available :

checkKey(); asks the driver for the key
checkLicense(); asks the driver for the license
useCar('?'); where '?' = 'yes' or 'no'

Test functions available :

keyOK() which returns true or false
licenseOK() which returns true or false

Warning !!!

Succeed your code with maximum 2 if, no else allowed.

Window to edit your JavaScript code

Test your script

Résult of the execution of your code

Notice: the four executions of your program must be correct without changing your code between them.

The car rental robot

The goal of this exercise is to construct Boolean expressions using AND (&&), OR (||) and / or NOT (!).

You are not to use « else » and since there are just 2 possibilities, it should be possible to achieve this with 2 successive « if » statements and AND (&&), OR (||) and / or NOT (!).

Use DeMorgan’s theorem to enable the robot to determine when it’s ok to let someone use the car based on the driver having their license and having obtained the key from the car rental agency.

Good work.

◊ ◊ ◊

© Rupert Meurice de Dormale 2017

All rights reserved, reproduction in whole or in part of the interface and / or the code forbidden without the written agreement of the author

The drawings of the robots are of Jean-Baptiste Sonnet.

adresse