SYSC 2004 Lecture 4: Triangle

7 views3 pages

Document Summary

* a triangle 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 triangle private int height; private int width; private int xposition; private int yposition; private string color; private boolean isvisible; * create a new triangle at default position with default color. public triangle() height = 60; width = 70; xposition = 210; yposition = 140; color = green; 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 triangle a few pixels to the right. public void moveright() movehorizontal(20); * move the triangle a few pixels to the left. public void moveleft() movehorizontal(-20); * move the triangle a few pixels up. public void moveup() movevertical(-20); * move the triangle 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