Chapter 3 of Koffman and Wolz provides an introduction to the concepts
in this lab. In order to focus on graphics, we will use applets rather
than applications for this lab. Recall that you run an applet with the
appletviewer rather than with the java interpreter. The .html file
is the argument for the appletviewer. You may also run applets from a
browser by visiting the .html page that contains the applet. More "hints"
and help on html are provided in the Hints section below.
All files and directories referenced here can be found in ~mmmartin/www/Lab3/.
$ cp -r ~mmmartin/www/Lab3/*
~/www/lab3/bkup
3. Partner 1: Modify the code so that the two squares are centered at the point 100,100. The inner red box should have height and width of 50 pixels, the black square should have height and width of 70 pixels. Name the file Squares1.java. You will have to create an .html file (Squares1.html) to view it.
Partner 2: Adapt the code from partner 1 so that the center point and the sizes of the squares are all declared as datafields. (e.g. the draw methods will refer to datafields rather than to literals such as 50 and 100.) Use datafields and local variables judiciously. Call this one Squares.java. You will be able to use the original html file (Squares.html) to view it.
Together: Write two more versions of the applet: one that shows squares of size 100 and 200 with their center at location 100, 100; the second one that shows squares half as big at location 50,50. Name your applets Squares2 and Squares3. Use the html file ManySquares to display all three applets at the same time!
4. Together: The file Castle.java from ~/lab3/Castles directory has both syntactic and run time bugs. Fix them. The proper solution can be found in the file ~mmmartin/Lab3/Castles/GoodCastles.class. The .java file (GoodCastle.java) is not provided for obvious reasons.
5. Together: An embroidery sampler is a pretty picture that illustrates mastery of embroidery technique. Create a sampler to illustrate your mastery of the draw methods. Include as many of the draw methods as possible from chapter 3. Be creative! Have fun! You are to write a single applet that combines methods written by each of you. Use the software development method to define your task (the picture you want to create), analyze and design the solution, and then divide up the methods that you implement. Note that between you, you are writing a single class that extends applet.
Create a web page that points toward each of your solutions. On each solution page include the applet as well as the source code. Do not place the applets for each task on a single page, link separate pages via an organizational page that identifies the programmers, the lab, the course etc.. Each "task" page should include a summary of the task, with full identification.
Submit a paper lab report during your class meeting on the due date. Submit only one report per partnership. The lab report should be produced on a word processor. Staple the completed report in the upper left corner. Do not use a report cover. The lab report should include in order:
ASK!!!!!!! your professor questions, in class, in lab, during office hours and especially via email. Please do not phone.
Don't know how to create a web site at TCNJ? Check out the following page: http://www.tcnj.edu/~im/tsnet/tsnet.html. Note that all files that are to be accessed by the outside world must have their protection value set to 755. Compiled class files ( *.class) do not get this value from the compiler. You must set it by hand. Make sure you are in the folder that contains the .class files and type: chmod 755 *.class (note that your folder must be within your /www/ folder for outsiders to access the applets from the web. Separate pages give information on html and file protections . Enjoy!
You may get help from classmates, tutors and other students outside your team on system technicals, syntax bugs, and small issues related to the Java language. Get help from anyone you can on how to print in the labs, how to move files from Mac to PC to Unix and back, how to add code to a word processing file, how to transfer a Word document written on a Mac to a PC and back.
You may NOT get help from the above groups to develop the solution to a task, to debug the code in task 3, or to implement your solutions in the other tasks. Other than your partner, no one may help you write, or debug your code except for times when you "simply cannot see what is wrong". If you cannot complete a task see your professor during lab, during office hours or send email.
The due date is considered the "last possible" moment to submit a report. You should be able to complete this project in a week if you distribute the work evenly between lab partners. A "down" system on the morning the lab is due will not cause an extension of the due date. Other universal calamities may be negotiated with the entire class. The point: hand SOMETHING of worth (e.g. the first few steps) in by the due date.