The dog walking robot

Action functions available :

watchOutside(); the robot looks at the weather outside
walk('?'); where '?' = 'yes' or 'no'

Test functions available :

rain() which returns true or false
watering() 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 dog walking 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 so that the robot only lets the cyber dog out if no raindrops are falling. If it begins to sprinkle, the dog will rust and will no longer even be able to go out.

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