[Java]Day2

1.Creating class to draw a picture

1a. public class Ground
{
  private Circle ground;
 
  public Ground(){
    ground = new Circle();
    ground.changeSize(1300);
    ground.changeColor("brown");
    ground.moveHorizontal(-370);
    ground.moveVertical(400);
    ground.makeVisible();
    }
 
}
1b. public class House
{
   private Triangle roof;
   private Square wall;
   private Square window;
  
   public House(){
    roof = new Triangle();
    roof.changeSize(90,200);
    roof.changeColor("green");
    roof.moveVertical(210);
    roof.moveHorizontal(200);
    roof.makeVisible();
   
    wall = new Square();
    wall.changeSize(160);
    wall.changeColor("red");
    wall.moveVertical(265);
    wall.moveHorizontal(110);
    wall.makeVisible();
   
    window = new Square();
    window.changeSize(50);
    window.changeColor("black");
    window.moveVertical(280);
    window.moveHorizontal(120);
    window.makeVisible();
   
    }
}
1.c
public class Sun
{
    private Circle image;
   
   
    public Sun(){
    image = new Circle();
    image.makeVisible();
    image.changeColor("yellow");
    image.changeSize(100);
    image.moveHorizontal(400);
}
2.create method to make sunrise sunset
 public void sunSet(){
    image.slowMoveVertical(700);
    }

 public void sunRise(){
    image.slowMoveVertical(-700);
    }

Nhận xét