CSSE 220: Object-Oriented Software Development
Scenes

You will do this exercise by yourself, but be quick to ask questions of your instructor, student assistants and classmates as desired.

Goals

This exercise will let you:

Grading rubric

Total possible: 50 points.

Do this project using documented stubs throughout.

Use good style throughout.

For any points deducted, the grader will put a CONSIDER tag saying how many points were deducted and why.

Here is a link to the General Instructions for Grading Programs.

Overview

You will implement this project in stages, testing at each stage to see if the project works correctly through that stage.

Before beginning work, read over the titles of the seven stages below. Those titles are the iterative enhancement plan for this program and will give you a sense of what you're up against. You should also look at the figures in each stage.

Once you have an idea of what’s expected, begin working at Stage 0 and proceed through the stages in order, getting help as needed.

Don't forget to commit your changes to SVN after each stage!

Implement the project

Implement according to the following Iterative Enhancement Plan (IEP):

Stage 0. Read the specification for the Face section of the project.

Here is a specification for this portion of the project:

 

Stage 1. A FacesViewer Test

Stage 1: Test FacesViewer
  1. Open Eclipse.
  2. From your individual repository, checkout the Java project called Scene

  3. You have been given the Face, FacesViewer and FacesComponent classes.

Stage 2. Filled Faces appear, but with no outline and no eyes and mouth yet

Stage 3: Faces with no eyes and mouths appear on the frame
  1. Create a Face class.
  2. Write documented stubs for Face, including (at this point) its:

    since that is all that FacesComponent should do at this stage.

  3. Implement Face per this stage and test your documented stubs.

  4. In FacesComponent, comment out the call to testDrawing and comment in the call to testFaceDrawingStage2. This will add the test cases for the Faces instead of the circles (the circles were only there to make sure everything checked out correctly).

Stage 3. Filled Faces appear, with outlines and eyes, but no mouth yet

Stage 3: Faces with outlines and eyes but no mouths appear on the frame
  1. Augment/modify your documented stubs for Face to include (at this point):

  2. In FacesComponent, comment out the call to testFaceDrawingStage2 and comment in the call to testFaceDrawingStage3.

  3. Modify your documented stub for FacesComponent to indicate that it (at this stage)

    Displays filled faces with outlines and eyes, but no mouth yet

    since that is all that FacesComponent should do at this stage.

  4. Implement Face and MyComponent per this stage and test your documented stubs.

Stage 4. Filled Faces appear with outlines, eyes and mouths

Stage 3: Faces with outlines, eyes and mouths appear on the frame
  1. Augment your program to draw the mouths of your Faces, as in the picture. Include the mouth color in your non-default constructor.

  2. In FacesComponent, comment out the call to testFaceDrawingStage3 and comment in the call to testFaceDrawingStage4.

  3. Use an Arc2D.Double object to draw the mouth. Look up its documentation as needed, but briefly:
  4. Refer to the Geometry of a Face diagram for the numbers to use to construct your Arc2D.Double.
  5. Don't get hung up on the geometry or the way that Arc2D.Double works! Get help if your mouths don't come around quickly!

Sun Instructions

Stage 1. Create SunViewer and SunComponent

  1. Add the SunViewer and SunComponent to your project

  2. Override the paintComponent method of the SunComponent class.

  3. Place the following constants in the SunComponent class.

Stage 2. Creating the Sun class

  1. Before we start putting together a Sun here are some notes about how a Sun is drawn:

  2. Create the Sun class

  3. Add the following constants to the Sun class:

  4. Add the following instance fields to the Sun class:

  5. Create a default constructor for the Sun class.

  6. Create a constructor with the following parameters:

    Set the instance fields based on the values provided to the constructor.

Stage 3. Draw your first sun

Default sun without rays
Default sun without rays
Default sun without rays
Default sun with rays

  1. In the SunComponent's paintComponent method, create a Sun using the default (parameterless) constructor, then draw it to the frame by calling the drawOn method.

  2. In the Sun's drawOn method, draw the center circle for the Sun based on its x and y values and the circleDiameter.

  3. Draw the rays in for the circle.

Stage 4. Drawing more suns

Default sun without rays
With guide rectangles to verify sun positioning is correct
Default sun without rays
Adding little suns!

  1. Test that your positioning is working properly. Add this code to SunComponent's paintComponent method:

    		//draws a rectangle around the default sun
    		g2.drawRect(30, 30, 240, 240);
    		
    		//draws a rectangle around a new sun in a particular position
    		s = new Sun(550, 100, 50, Color.BLUE);
    		s.drawOn(g2);
    		g2.drawRect(515, 65, 120, 120);
                    
  2. Modify SunComponent's paintComponent method create multiple little Suns (use NUM_LITTLE_SUMS for the exact number), and draw them to the screen

Scene Instructions

Stage 0. Create the SceneViewer, SceneComponent, and Scene classes

  1. Create the SceneViewer and SceneComponent using the same process as for Faces and Suns

Stage 1. Create Scene

  1. Create a sky for the Scene by drawing a blue rectangle in the upper 375 pixels of the component.

  2. Create grass for the Scene by drawing a green rectangle in the rest of the component.

Stage 2. Finish Scene

Stage 1: Test FacesViewer
  1. Add a Sun at the default location to the SceneComponent.

  2. Create a Face at 450, 350, with a radius of 30, a face color of yellow, an outline color of black, an eye color of blue, and a mouth color of red. Draw it to the SceneComponent.

  3. Make sure it appears like the image on the right.

  4. NOTE: This should only take a few lines of code. If you find yourself adding more than 4 or 5 lines, you're probably doing too much work.

Turn-In Instructions

Add your files to source control: Right-click on the project, then select Team --> Commit. Be sure to add a brief commit message that describes what you have done. If you choose to commit a single file instead, you can right-click on that file and select Team --> Add to Version Control. However, you must commit that file in order for it to be posted on the SVN server.

Commit your project to your individual repository often is strongly encouraged, not only when you are done.