CSE 142 Lecture 7: Drawing in Java with Parameters and For Loops

78 views3 pages
Verified Note
10 Oct 2018
School
Course

Document Summary

Close the file and no(cid:437) you can run your code. For loops to create multiple duplicates i(cid:290) dra(cid:363)i(cid:290)g. ja(cid:362)a. // inserting a for loop here will repeat this van drawing the set. 13 for ( int i = 0; i < 5; i++) { 14 for ( int j = 0; j < 10; j++) { 15 drawvan(brush, 10 + i * 50, 130 + j * 30, 40); 20 public static void drawvan(graphics brush, int x, int y, int size) { // all at once but then each van would be the same size. 22 // (coordinates x and y in the method must be applied below!) 23 // the size is 100 right now. Write each "int size" as a function of. 24 // if you wanted to, you could use one call constant and change it. 30 brush. fillrect(x + (size * 7 / 10), y + (size / 10), size * 3 /

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