Question: 1 . Add to the House class a method named changeRoofColor that has a String parameter variable and changes the color of roof according to

1. Add to the House class a method named changeRoofColor that has a String parameter variable and changes the color of roof according to the argument passed in the parameter. (Use changeColor, not setColor.)
2. Add to the House class a method named changeWallColor that has a String parameter variable and changes the color of wall according to the argument passed in the parameter. (Use changeColor, not setColor.)
3. Add to the House class a method named changeWindowColor that has a String parameter variable and changes the color of window according to the argument passed in the parameter. (Use changeColor, not setColor.)
4. Add to the House class a method called moveHorizontal that takes an integer as input and moves the entire house that distance horizontally (to the right for a positive integer and to the left for a negative integer).
This method needs to call the moveHorizontal methods for wall, roof, and window. You must move wall first because otherwise it will overwrite the move of window.
5. Add to the House class a method called moveVertical similar to moveHorizontal that takes an integer as input and moves the entire house that distance vertically.
6. Add to the House class a method called makeInvisible that makes the entire house invisible.
7. Add to the House class a method called makeVisible that makes the entire house visible again.
The code in question these must be added to:
public class House
{
private Square wall;
private Triangle roof;
private Square window;
/**
* No parameter constructor for objects of class House.
*/
public House()
{
wall = new Square();
wall.makeVisible();
wall.changeSize(100);
wall.moveHorizontal(40);
wall.moveVertical(150);
roof = new Triangle();
roof.makeVisible();
roof.changeSize(50,150);
roof.moveHorizontal(100);
roof.moveVertical(135);
roof.changeColor("black");
window = new Square();
window.makeVisible();
window.moveHorizontal(50);
window.moveVertical(170);
window.changeColor("blue");
}
/**
* This is the main method.
*
* @param args command-line arguments (not used)
*/
public static void main(String[] args)
{
House house = new House();
}
}

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!