Loading...

Combined

Up until now you’ve written two lines of code to light both eyes up in color.
Look at the example on the left!

In this example we get to know a new method:
bob3.setEyes(color1, color2);

This method allows us to turn on both eyes in color with a single line of code.

Our new method
bob3.setEyes(color1, color2);

has two parameters: color1 and color2

We replace the text color1 with the uppercase color name that eye 1 should have, e.g. WHITE

We replace the text color2 with the uppercase color name that eye 2 should have, e.g. ORANGE

We can replace the code in lines 8 and 9 with the statement

bob3.setEyes(WHITE, ORANGE);

Test your new program on your BOB3.
Compile and test your program on BOB3.
1: If both eyes should be lit in orange, can you simply use bob3.setEyes(ORANGE);?
 You haven’t completed anything yet!
 Super, so far so good…
 Super, you got it all right!
 Sadly not correct…
 One answer is correct
 A couple are correct…