Prof. Reed, CS 102, Spring '09
Due Tuesday 9/8 at 2:00 p.m.
Description
Write an Applet in Java to draw 5 lines on the screen. The lines should appear connected, and mouse clicks "advances" the lines, where as a new line appears the oldest line disappears.
See the above short YouTube video of what this program looks like when it is running.
You need to know the following concepts in order to write this program:
How to use BlueJ, simple input and output, using variables, simple if statements, assignment statements, how to copy your solution over to your UNIX account, using turnin.
Notes:
Make sure you have read the first two of chapters of the book before starting this assignment. You may also need sections of chapter 3.
Make sure you read the syllabus regarding the grading criteria. Particularly on the first program, students tend to lose points for not documenting adequately and for not choosing meaningful variable names.
See these sample programs (linked individually below), which gives you a good starting point, as well as illustrates various concepts you need for this program. These programs are as follows: DrawLine0 Draws a line from upper-left corner to mouse position DrawLine1 Adds a status print line at bottom of screen DrawLine2 Draws line relative to last line end point DrawLine3 Draws 2 connected lines, advancing with mouse clicks DrawLine4 Lines drawn at right angles; Line length grows (FYI only, you don't need to do this on program 1) DrawLine5 Doesn't draw intersecting lines
Remember to include your NAME and which program this is in the documentation header of your programs AS WELL AS in the output that appears on the screen.
Transfer your program into your CS account. Note that your CS account information is posted outside the elevators on the 9th floor in SEO, and also posted on the wall in the CS lab at 2260 SEL.
You may only use concepts discussed up through chapter 3 in our text (no arrays, defining other classes, or other stuff that we haven't covered yet).
Turnin your program electronically using the "turnin" command from your CS account. You should have already done this once in your first lab. If you missed this for some reason, please look at the web site "Lab & TA Info" page, which links to the content done in the first lab. The turnin command should be used as follows:
turnin -c cs102 -p prog1 linedraw.java
where the file containing your solution is called linedraw.java . To practice using the turnin command you can use the project named "junk" (rather than prog1 in the example above.). Do not name your program anything besides linedraw.java Failure to follow this instruction will result in a 5 point penalty.
If you want to verify that your project was turned in, look in the turnin directory for a file with your userid. For instance for this project, from your CS account you would type:
ls -l ~i102/submit/prog1
Note that you can execute turnin as many times as you would like, up until the program deadline when turnin will be disabled for this project. Each time you execute turnin for a project, you overwrite what you had turned in previously for that project. For this first program only, and only if you do not yet have an cs account, you may email your solution to your TA. Note that emailing your solution rather than using turnin may significantly delay the grading of your assignment. If you email your program, but do in fact have a CS account, you will be assessed a 10 point penalty.