forked from giakinh0823/java-programming-tutorial
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathPainting.java
More file actions
94 lines (77 loc) · 2.36 KB
/
Copy pathPainting.java
File metadata and controls
94 lines (77 loc) · 2.36 KB
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
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package DTO;
import java.util.Scanner;
/**
*
* @author GIA KINH
*/
public class Painting extends Item{
private int height;
private int width;
private boolean isWatercolour;
private boolean isFramed;
public Painting() {
}
public Painting(int value, String creator, int height, int width, boolean isWatercolour, boolean isFramed) {
super(value, creator);
this.height = height;
this.width = width;
this.isWatercolour = isWatercolour;
this.isFramed = isFramed;
}
public int getHeight() {
return height;
}
public void setHeight(int height) {
this.height = height;
}
public int getWidth() {
return width;
}
public void setWidth(int width) {
this.width = width;
}
public boolean isIsWatercolour() {
return isWatercolour;
}
public void setIsWatercolour(boolean isWatercolour) {
this.isWatercolour = isWatercolour;
}
public boolean isIsFramed() {
return isFramed;
}
public void setIsFramed(boolean isFramed) {
this.isFramed = isFramed;
}
@Override
public String toString() {
return "Painting[" + super.toString() + "height=" + height + ",width=" + width + ",isWatercolour=" + isWatercolour + ",isFramed=" + isFramed + ']';
}
public void inputPainting(){
super.input();
Scanner scanner = new Scanner(System.in);
System.out.print("Input a height: ");
this.height = scanner.nextInt();
scanner.nextLine();
System.out.print("Input a width: ");
this.width = scanner.nextInt();
scanner.nextLine();
System.out.print("Is watercolour: ");
this.isWatercolour = scanner.nextBoolean();
scanner.nextLine();
System.out.print("Is Framed: ");
this.isFramed = scanner.nextBoolean();
scanner.nextLine();
}
public void outputPainting(){
super.output();
System.out.println("Height: " + height);
System.out.println("Width: " + width);
System.out.println("Is Watercolour: " + isWatercolour);
System.out.println("Is Framed: " + isFramed);
}
}