SYSC 2004 Lecture Notes - Lecture 3: Bluej, Tamil Eelam

37 views2 pages

Document Summary

But wait, there"s more: being an electronic picture, it. You can set it to black-and-white display and back to. * colors (only after it"s been drawn, of course). * this class was written as an early example for teaching java with bluej. * @author michael k lling and david j. barnes. * @version 2016. 02. 29 public class picture private square wall; private square window; private triangle roof; private circle moon; private boolean drawn; private circle noon; * constructor for objects of class picture public picture() wall = new square(); window = new square(); roof = new triangle(); moon = new circle(); noon = new circle(); drawn = false; * draw this picture. public void draw() if(!drawn) { wall. movehorizontal(-140); wall. movevertical(20); wall. changesize(120); wall. makevisible(); window. changecolor(black); window. movehorizontal(-120); window. movevertical(40); window. changesize(40); window. makevisible(); roof. changesize(60, 180); roof. movehorizontal(20); roof. movevertical(-60); roof. makevisible(); moon. changecolor(blue); moon. movehorizontal(120); moon. movevertical(-40); moon. changesize(80); moon. makevisible(); drawn = true; * change this picture to black/white display public void setblackandwhite() wall. changecolor(black); window. changecolor(white); roof. changecolor(black); moon. changecolor(black);

Get access

Grade+20% off
$8 USD/m$10 USD/m
Billed $96 USD annually
Grade+
Homework Help
Study Guides
Textbook Solutions
Class Notes
Textbook Notes
Booster Class
40 Verified Answers
Class+
$8 USD/m
Billed $96 USD annually
Class+
Homework Help
Study Guides
Textbook Solutions
Class Notes
Textbook Notes
Booster Class
30 Verified Answers