CSE 142 Lecture Notes - Lecture 6: Redundant Code

40 views3 pages
Verified Note
11 Oct 2018
School
Course

Document Summary

1 // before you can run the code that starts in line 5, 2 // you must import this program which allows you to use various graphics. 5 // similar to drawing a painting in an art class, you must set up. 6 // the java page starting with the first step in a painting: getting a. 13 pen. setcolor(color. red); // default pen color is black; use this. 19 // the above code will run perfectly to draw the below rectangle. 20 // however, it is so redundant that this reminds us that we should. **reminder note: before you can run your graphics code in ja(cid:436)a, remember to ha(cid:436)e imported and. 8 // so instead of the redundant code, use this for loop: 11 for(int i = 1; i <= 5; i++) { 12 pen. drawrect(50, 50, i * 20, i * 20); 15 // in order to draw the diagonal black line, insert the code.

Get access

Grade+
$40 USD/m
Billed monthly
Grade+
Homework Help
Study Guides
Textbook Solutions
Class Notes
Textbook Notes
Booster Class
10 Verified Answers
Class+
$30 USD/m
Billed monthly
Class+
Homework Help
Study Guides
Textbook Solutions
Class Notes
Textbook Notes
Booster Class
7 Verified Answers

Related Documents