6
answers
0
watching
215
views
28 Jul 2018
37. True or false, the output of these two code fragments is always the same? That is, for a given pair of values for x and y, these fragments will both print 100 or both print 0. int z = 0; if (x < 20 11 y < 30) { z = 100; int z = 0; if (x < 20){ z = 100; println(z); if (y < 30) { Z = 100; println(z); The remaining questions are all about the following program // Create a class to represent a light bulb that can be // positioned, sized, given a color, and turned on and off as indicated // by the following usage of that class. Light lighti, light2, light3, light4; void setup() { size ( 400, 400); light1 = new Light (25, 25); light 2 - new Light (width-30, height-60, false); // set initially off light3 = new Light (width/2, height/2, 50); // specify the size light4 = new Light (30, height/2, 75, color (255, 0, 0));//set size and color light4.turnoff(); void draw() { lightl.show(); light2.show(); light3.show(); light4.show(); void mousePressed() { if (lightl.clicked()) { lighti.toggle(); if (light2.clicked()) { light2.toggle(); if (light3.clicked()) { light3.toggle(); if (light4.clicked()) { light4.toggle();
37. True or false, the output of these two code fragments is always the same? That is, for a given pair of values for x and y, these fragments will both print 100 or both print 0. int z = 0; if (x < 20 11 y < 30) { z = 100; int z = 0; if (x < 20){ z = 100; println(z); if (y < 30) { Z = 100; println(z); The remaining questions are all about the following program // Create a class to represent a light bulb that can be // positioned, sized, given a color, and turned on and off as indicated // by the following usage of that class. Light lighti, light2, light3, light4; void setup() { size ( 400, 400); light1 = new Light (25, 25); light 2 - new Light (width-30, height-60, false); // set initially off light3 = new Light (width/2, height/2, 50); // specify the size light4 = new Light (30, height/2, 75, color (255, 0, 0));//set size and color light4.turnoff(); void draw() { lightl.show(); light2.show(); light3.show(); light4.show(); void mousePressed() { if (lightl.clicked()) { lighti.toggle(); if (light2.clicked()) { light2.toggle(); if (light3.clicked()) { light3.toggle(); if (light4.clicked()) { light4.toggle();
rosi10agarwalLv10
29 Mar 2023
Already have an account? Log in
syedazmath1627Lv10
3 Feb 2023
Already have an account? Log in
Sixta KovacekLv2
29 Jul 2018
Already have an account? Log in