Question: Part 2 : Open the house project from within BlueJ. ( You will use this for parts 2 , 3 , and 4 . )

Part 2: Open the "house" project from within BlueJ. (You will use this for parts 2,3, and
4.)
o Create an instance of "Picture". Invoke the "draw" method and then the other
methods.
o How do you think "Picture" draws the picture?
o Look at the pop-up menu for class "Picture". Select "Open editor". Look at the
code.
o In the code, find where the picture is drawn and change the sun from yellow to
blue.
Part 3: Take your solution to part 2, and rename sun to moon. Make the moon blue
and move it a little further to the right of the picture. (Aside: You can really put the moon
anywhere you like, as long as you get the desired effect. We found that unless we moved
the moon a bit, the added circle ended up covering part of the roof of the house, which
looked strange!) Now you are going to add a new method "moonPhases" to model the
different phases of the moon. Our model of the moon phases is to be implemented by
moving another (new) circle across our blue moon from right to left, to get an effect
similar to the phases of the moon (in super-fast motion). Think about what colour this
new circle should be. Check that all the other methods still work properly. (This is called
"regression" testing.)
Part 4: Start with your solution to part 3. The moon is normally only visible at night, i.e.
when it is dark. Figure out how to change the background colour of your picture from
white to black. (Hint: This is not set in the Picture class.) Then redo part 3. Again, do
your regression testing.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!