Tino APCS

Lab 2.3 CoolHouse

Assignment

For this lab, you will make a fancy house scene using house part classes written by your classmates.

  1. Download the JAR file for your period (see Schoology assignment) and install it in BlueJ the same way you did with gpdraw.
  2. Make an awesome house scene with lots of fancy parts using your classmates' house parts. You could even have multiple houses in the same scene.
  3. Name your program PX_LastName_FirstName_CoolHouse.java. > Example: P1_Wang_Michael_CoolHouse.java
  4. At the top your class, include a multi-line comment stating:
/*
    Name:       (your name here)
    Date:       (submission date)
    Period:     (your period)

    Is this lab fully working?  (Yes/No)
    If not, explain:
    If resubmitting, explain:
*/

Suggested Workflow

  1. Create a separate Java file just for testing individual parts.
  2. Start with a background. Search your period's API for backgrounds and pick one you like. You can always add separate Sun, Cloud, etc objects to it later.
  3. Embellish your picture with lots and lots of parts to build a full scene that looks awesome.

More Detailed Workflow

  1. Download the jar file (i.e. period_1_house_parts.jar)
  2. Open BlueJ
  3. Go to BlueJ -> Preferences -> Libraries Tab -> Add File and select period_1_house_parts.jar (Exact menus may vary from mac to PC but it is the same process you used to add the gpdraw.jar library)
  4. Reset the Java Virtual Machine (Tools --> Reset Java Virtual Machine). There is also a button in the bottom right of the main BlueJ Window that resets the Java Virtual Machine. It looks like a arrow showing a U-Turn. FYI this is also how you can end program that is stuck in an infinite loop in BlueJ. Worst case, you can totally quit BlueJ to reset the JVM, but that is overkill.
  5. Create a class
  6. import period_1_house_parts.*;
  7. import gpdraw.*;
  8. Create a main method.
  9. In the main method. create a SketchPad and DrawingTool
  10. Look in the API to find a class you want to use.
  11. See what constructors and methods the class has.
  12. Create an instance of the class, passing the desired values for each parameter.
  13. Call any of the desired setters to set attributes
  14. call draw() on the instance of the class you created
  15. Run your program to see what the door looks like. If you like it, modify the attributes as needed to make it a part of your overall picture.
  16. Repeat steps 10-15 until you have a complete scene.

Example:

P0_McLeod_Ted_Door door = new P0_McLeod_Ted_Door(pen, 50, 100);
door.setDimensions(30, 60);
door.draw();

You must Sign In to submit to this assignment

Last modified: September 11, 2023

Back to Lab 2.2 Finalhouse

Dark Mode

Outline