/** * CS139 - Programming Fundamentals * Department of Computer Science * James Madison University * @version Spring 2016 */
Practice writing and calling void
methods that take parameters.
Following coding standards.
Using Checkstyle to check coding standards.
For this activity we will make use of the StdDraw
class developed by Robert Sedgewick and Kevin Wayne at Princeton
University. This class provides a set of methods that make it possible to create
simple drawings in Java.
You can find the complete documentation online, but today we will only be working with the following methods:
DrawDemo.java
in jGRASP. Take a minute to read
over the code, then compile and execute it.
DrawDemo.java
to place a small filled rectangle in
the upper-left corner of the drawing window. Test your modifications.
Houses.java
using jGRASP. Take a minute to
read over the provided code, then try running it.drawHouse
that satisfies the following requirements:
double
parameters named x
and y
.
drawDoor
. YOU SHOULD NOT COPY THE CONTENTS OF drawDoor
INTO drawHouse
!
Modify your main
so that in includes three calls
to drawHouse
. Houses should be drawn at (.2, .5), (.5,
.5) and (.8, .5). The result should look like the following:
Make any necessary modifications to ensure that your finished program conforms to the course style guide.
Follow the instructions on
the CS139 Checkstyle page
to run Checkstyle on Houses.java
. Fix any style issues
that are flagged.
In order to complete this lab you need to:
Houses.java
and upload the result through
Canvas. You can save the image through the file menu of the StdDraw
drawing window. The file name should be "houses.jpg".
Houses.java
through Web-CAT.
Web-CAT is configured to run Checkstyle. In order to get full credit,
your submission will need to pass all of the formatting tests.drawWindow
method to Houses.java
and use it to improve your drawHouse
method. drawStreet
method that draws three houses with a road
in front of them. Modify your main to include two calls to drawStreet
.