157 Lab - Villages
157 Lab - Villages

Assigned partners for today are...
  • Shomari and Alex
  • Joe and Beau
  • Drew and Mads
  • Calid and Mikayla
  • Jeremy and Jake
  • Robin and Matt
  • Toya and Jennifer
  • Will and Zosimo
  • Hailey and Amanda

Partner names to the left type first. Your team will work only on this person's account today. I will tell you when to switch to the second partner typing. The second partner should not be logged into any machine today.

Put as much space as you reasonably can between yours and the other teams.

For this lab you'll be reverse engineering again. Please do each of the following steps in the order specified. Along the way, you'll gradually be writing source code which generates bytecode with the functionality of that given in step III.

Create a program which you will save as VillageClient.java with the following features:

  1. Pressing will create a red house, release will create a slightly smaller blue house. Both should have black doors which are sized to be half as tall as the house and one quarter as wide. They should be placed so that doors of the red houses are located slightly to the left of the center of the house while the doors for the blue houses are located slightly to the right of center. It's high noon in the village but time is passing...

    On both mouse enter and exit a large yellow sun will move a short distance from left towards right.


  2. Switch Typists
    Add a roof to your houses. This is *only a little* tricky since you'll have to use two lines. There is no triangle drawing graphic available in the objectdraw library, so you won't be able to fill in your roof with a color. You may color the lines if you wish or leave them black as in the example.


  3. Switch Typists
    Add a peaked mansion on a mouse click. The color is your choice but should NOT be one of the pre-defined colors. The color you choose should make it necessary for you to construct it yourself. Use the same dimensions for the door but center it on the front of the house.



  4. Switch Typists
    And finally, every village needs a tree or two. The McMansion folks can afford some landscaping...


  5. Ok, now share the final code with your partner and split up. You are now working alone on separate machines -- as far apart as possible. Since you both worked on this code and understand it fully you should be able to do the "signature" of your masterpiece separately. (If you BOTH can't do it, then you've not worked well together.) The goal of every lab is to finish but ONLY IF YOU BOTH understand. Otherwise, ... well, maybe that won't happen.

    This will "mess up" the village so... put it in another file (ie, source code for another class). We'll figure out how to add to the village landscape later!

    Write a client which allows you to write your signature in little ovals of YOUR favorite color. Here's mine in glorious Sewanee purples.

  6. If you've finished with all of the above, still working solo, go back to your landscaped village with mansions and trees and add "something" else. What else is up to you. It could be apples on those trees, maybe an apple orchard, fences, roads, cars, bridges, a train, a library,... whatever; as long as it fits in with the feng shui of the village.

    Play around with some randomization (objects constructed using RandomIntGenerator class from Chapter 3 of your textbook.)