SYSC 2004 Lecture 3: Square

8 views3 pages

Document Summary

* a square that can be manipulated and that draws itself on a canvas. * @author michael k lling and david j. barnes. * @version 2016. 02. 29 public class square private int size; private int xposition; private int yposition; private string color; private boolean isvisible; * create a new square at default position with default color. public square() size = 60; xposition = 310; yposition = 120; color = red; isvisible = false; If it was already visible, do nothing. public void makevisible() isvisible = true; draw(); If it was already invisible, do nothing. public void makeinvisible() erase(); isvisible = false; * move the square a few pixels to the right. public void moveright() movehorizontal(20); * move the square a few pixels to the left. public void moveleft() movehorizontal(-20); * move the square a few pixels up. public void moveup() movevertical(-20); * move the square a few pixels down. public void movedown() movevertical(20);

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