forked from giakinh0823/java-programming-tutorial
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathStatue.java
More file actions
64 lines (52 loc) · 1.41 KB
/
Copy pathStatue.java
File metadata and controls
64 lines (52 loc) · 1.41 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
/*
* 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 Statue extends Item{
private int weight;
private String color;
public Statue() {
}
public Statue(int value, String creator, int weight, String color) {
super(value, creator);
this.weight = weight;
this.color = color;
}
public int getWeight() {
return weight;
}
public void setWeight(int weight) {
this.weight = weight;
}
public String getColor() {
return color;
}
public void setColor(String color) {
this.color = color;
}
@Override
public String toString() {
return "Statue[" + super.toString() + ",weight=" + weight + ",color=" + color + ']';
}
public void inputStatue(){
super.input();
Scanner scanner = new Scanner(System.in);
System.out.print("Input a weight: ");
this.weight = scanner.nextInt();
scanner.nextLine();
System.out.print("Input a color: ");
this.color = scanner.nextLine();
}
public void outputStatue(){
super.output();
System.out.println("Weight: " + weight);
System.out.println("Color: " + color);
}
}