Week 2 in-lab exercise for Lab 4


If you are looking for the actual lab 4, please follow this link.

In-Lab Work - week 2

You will be finishing up the in-lab exercise from last week if it wasn't completed, and will be starting on the applet in-lab exercise.

Here is what you would do in the in-lab exercise:

  1. Write an html document, called MyCircle.html, with an applet tag in it that calls our class file for this week. You can download the sample MyCircle.html here. Remember to right click on this link and save as, instead of trying to open the file directly.
  2. You will need to create a project as a Java applet, and use the HTML file you created or downloaded in the above step in this project.
  3. Write a java program that will draw either a red or a blue circle at a point where the user clicks with the radius the user enters.

    The first step is to gather all of the information to draw the circle. First ask for a color (blue or red) and read it in a String. This tells you the color in which the circle will be drawn. Next prompt the user to enter a number between 1 and 10. This number will be the radius of the circle. Finally have the user click on a point. This point with be the center of the circle. Now, all that is left to do is to draw the circle to screen.

Name this program MyCircle.java and submit it by sending an email to a201@cs.indiana.edu with a subject that will be given to you in class.