-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDrawingCanvas.java
54 lines (45 loc) · 995 Bytes
/
DrawingCanvas.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
import java.util.Scanner;
public class DrawingCanvas {
//instance variables
private char background;
private int width;
private int height;
//default constructor
public DrawingCanvas(){
setBackground('-');
setHeight(10);
setWidth(6);
}
//constructor
public DrawingCanvas(int width,int height,char background ){
setBackground(background);
setWidth(width);
setHeight(height);
}
//copy constructor
public DrawingCanvas(DrawingCanvas drawingCanvas){
background=drawingCanvas.background;
width=drawingCanvas.width;
height=drawingCanvas.height;
}
//accessors
public char getBackground(){
return background;
}
public int getWidth(){
return width;
}
public int getHeight(){
return height;
}
//mutators
public void setBackground(char background){
this.background=background;
}
public void setWidth(int width){
this.width=width;
}
public void setHeight(int height){
this.height=height;
}
}