IS101Y / CMSC 104Y: First Year IT

Processing Assignment

Due: September 25, 2012

Software design is, ultimately, a user based experience. The goal of this assignment is to design an easy-to-use Processing application to help design a garden. Most gardeners decide what to plant in their gardens during the cold winter months so that they will be prepared for the planting season come spring. Your task is to automate the planning process.

You’ll implement your garden planning application in Processing using concepts you’ve seen in class or read about in the Processing book. Your program should accept user input about the garden shape, kind of plants, and number of plants. Given those constraints, it should lay out a garden, spacing the plants relatively equally in the specified shape. For example, a garden with 16 carrots in a square layout would look like this:


- Display a menu with buttons allowing the user to choose the garden shape (square, circle, triangle). Clicking the mouse button while the cursor is in this area, selects to corresponding option. Only the square option needs to be implemented in the base assignment. If the user chooses the circle or triangle, the program should print a helpful error message.

- Display a menu with buttons allowing the user to choose what kinds of plants they want in their garden (carrots, tomatoes or flowers). There are images provided for the buttons, however, extra credit is available for coding simple plant shapes using Processing.


- Provide a text box for the user to input the number of plants they want in their garden. When they enter their number, you should check for user input errors. Make sure the number is not less than 0 or greater than 36 (which is the maximum number of plants).

- Take the users input for the type and number of plants and write a loop that will space the desired number of plants evenly in the given shape. For the square shape, first decide how many rows/columns (they should be equal) and then position plant in those locations.

Extra credit:

- Implement the circle and triangle options from the garden shape menu. 5 points.

- Build button labels and plant pictures from geometry calls in Processing (rather than from images). 5 points.

- Implement a free-form garden shape option that allows the user to input a shape with the mouse. In order to implement this capability, the program must allow for the input of the (closed) shape and the spacing of the plants in the defined area. 10 points.

How to get the images:

On the Blackboard page, go to “Course Documents” and click on the folder “Images for Processing Assignment”. Download the three images into the same directory as your code for the assignment.

Suggestions for how to start:

- Write out some pseudocode sketching in your design. Good functions to include might be a drawMenu function, a drawGarden function, and your main draw function that calls both of those.

- Write your drawMenu function first, and test it to make sure it works before you start the drawGarden function. Testing your code in small, modular units is much easier than writing a whole long program and hoping it will work. Modular testing saves a lot of time.

Coding standards:

You should write code so that it is easy for another software developer (or your teaching assistant!) to pick up your code and understand how it runs.

- Start your code with a header comment with your name, email, and which discussion section you are in (1 pm or 2 pm).

- Your variable names should make sense and be meaningful. For example, naming a variable Plant_Type instead of variable A is more meaningful.

- Any functions you write should have a short descriptive comment explaining what purpose they accomplish. For example, if you have a “drawMenu” function, the comment might say, “This function creates a menu for the user. It pulls the images in for the plants and displays buttons”.

- indentation should clearly indicate logical hierarchical structure of program. For example:

        if(user == Alec){

                println(“Alec is cool.”);


        else if(user == Emily){

                println(“Emily is cool.”);



                println(“The TA’s are fun, cool people.”);


Notice how the braces are lined up with the corresponding statement, and the conditional statement is indented under the if statement that causes it to happen.

Collaboration and individual work:

On this assignment, you are allowed to talk with anyone about the general problem, different approaches, and the capabilities and syntax of Processing. Report those discussions (except those with the course staff) on your project description. You must write all your own code, however.

What to turn in:

1. Submit your code using Blackboard.

2. Turn in (in class on the due date) a hard copy description of your project. It should have the following elements: