-
Notifications
You must be signed in to change notification settings - Fork 0
/
Massages.java
65 lines (52 loc) · 1.36 KB
/
Massages.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
package healthcenter;
import java.util.HashMap;
public class Massages {
//massages' attributes
private double price;
private String name;
private int duration;
//empty constructor
public Massages() {
setPrice(40);
setDuration(45);
setName("Massage");
}
//full constructor
public Massages(double p, String n, int m) {
setPrice(p);
setDuration(m);
setName(n);
}
//set massage's price
public void setPrice(double p) {
price = p;
}
//get massage's price
public double getPrice() {
return price;
}
//set massage's duration
public void setDuration(int m) {
duration = m;
}
//get massage's duration
public int getDuration() {
return duration;
}
//set massage's name
public void setName(String n){
name = n;
}
//get massage's name
public String getName() {
return name;
}
//toString() method
public String toString() {
String message;
if(getPrice() != 0)
message = "The " + getName() + " massage costs " + getPrice() + "€ and lasts for " + getDuration() + " minutes.\n";
else message = "";
return message;
}
}