SYSC 2004 Lecture Notes - Lecture 3: Semi-Major And Semi-Minor Axes, Ellipse

112 views1 pages

Document Summary

The state of a pen object named pen1 is: xposition : 40; yposition : 20; direction : 2; down : true; colour : // this refers to the current object this. xposition = newx; this. yposition = newy; } xposition and yposition changes. Write a method called setwidth() that changes the width of the line that a pen will draw. The method has one parameter, which is the new line width. /** position of the pen along the x-axis. private int xposition; /** position of the pen along the y-axis. private int yposition; /** the direction in which the pen will move. private int direction; /** true means that the pen is down on the canvas and will draw when it is moved. private boolean down; /** the width of the line drawn by the pen. private int width public void setwidth(int width) { if (width >= 0) { this. width = width; }}

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

Related Documents