Lab 1 / Exercises 5

public class Picture
{
	//Defines what the picture is made of
	private Square wall;
	private Square window;
	private Triangle roof;
	private	Circle sun;

    //This 'method' is automatically run when the program starts
    public static void main (String[] args)
    {
       //Creates a new picture object and calls it P1
        Picture P1 = new Picture();
    }
    
    //This defines what the picture will be like when its created.
    public Picture()
    {
		wall = new Square();
		wall.moveVertical(80);
		wall.changeSize(100);
		wall.makeVisible();
		wall.changeColor("black");
		
		window = new Square();
		window.changeColor("blue");
		window.moveHorizontal(50);
		window.moveVertical(100);
		window.makeVisible();

		roof = new Triangle();	
		roof.changeSize(50, 140);
		roof.moveHorizontal(60);
		roof.moveVertical(70);
		roof.makeVisible();

		sun = new Circle();
		sun.changeColor("yellow");
		sun.moveHorizontal(180);
		sun.moveVertical(-10);
		sun.changeSize(60);
		sun.makeVisible();
	}

	

}

Leave a comment

Your email address will not be published. Required fields are marked *