-
Notifications
You must be signed in to change notification settings - Fork 1
/
Apartment.java
94 lines (73 loc) · 1.91 KB
/
Apartment.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
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
package com.salimov.yurii.lesson06.task02H;
import javax.persistence.*;
@Entity
@Table(name = "Apartments")
public final class Apartment {
@Id
@GeneratedValue(strategy = GenerationType.AUTO)
private long id;
private String region;
@Column(nullable = false)
private String address;
private double area;
private int rooms;
private double price;
public Apartment() {
}
public Apartment(
final String region,
final String address,
final double area,
final int rooms,
final double price
) {
this(address, price);
this.region = region;
this.area = area;
this.rooms = rooms;
}
public Apartment(final String address, final double price) {
this();
this.address = address;
this.price = price;
}
@Override
public String toString() {
return "Apartment id = " + this.id + ":" +
"\n\tregion - " + this.region +
"\n\taddress - " + this.address +
"\n\tarea - " + this.area +
"\n\trooms - " + this.rooms +
"\n\tprice - " + this.price;
}
public void setRegion(final String region) {
this.region = region;
}
public String getRegion() {
return this.region;
}
public void setAddress(final String address) {
this.address = address;
}
public String getAddress() {
return this.address;
}
public void setArea(final double area) {
this.area = area;
}
public double getArea() {
return this.area;
}
public void setRooms(final int rooms) {
this.rooms = rooms;
}
public int getRooms() {
return this.rooms;
}
public void setPrice(final double price) {
this.price = price;
}
public double getPrice() {
return this.price;
}
}