-
Notifications
You must be signed in to change notification settings - Fork 0
/
Museum.java
112 lines (91 loc) · 2.65 KB
/
Museum.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
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
/**
* Created by henryhargreaves on 10/11/2015.
*/
public class Museum {
private String name, location;
private boolean type;
private int noOfItems;
private float entryFee;
int noOfExhibitions = 0;
int noOfEmployees = 0;
int noOfFacilities = 0;
static final int MAX_NUMBER_EXHIBITIONS = 10;
Exhibition [] exhibitions = new Exhibition[MAX_NUMBER_EXHIBITIONS];
static final int MAX_NUMBER_EMPLOYEES = 10;
Employee [] employees = new Employee[MAX_NUMBER_EMPLOYEES];
static final int MAX_NUMBER_FACILITIES = 10;
Facility [] facilities = new Facility[MAX_NUMBER_FACILITIES];
public Museum(String name, String location, boolean type, int noOfItems, float entryFee) {
this.name = name;
this.location = location;
this.type = type;
this.noOfItems = noOfItems;
this.entryFee = entryFee;
}
public void addExhibition (Exhibition exhibition){
try {
this.exhibitions[noOfExhibitions]=exhibition;
noOfExhibitions++;
exhibition.setMuseum(this);
}catch (Exception e){
System.out.println("Error");
}
}
public void printDetails(){
System.out.println("Name: "+name);
}
public void addEmployee (Employee employee){
try{
this.employees[noOfEmployees]=employee;
noOfEmployees++;
employee.setMuseum(this);
}catch (Exception e){
System.out.println("Error");
}
}
public void addFacility (Facility facility){
try{
this.facilities[noOfFacilities]=facility;
noOfEmployees++;
facility.setMuseum(this);
}catch (Exception e){
System.out.println("Error");
}
}
public String getName() {
return name;
}
public Facility[] getFacilities() {
return facilities;
}
public Employee[] getEmployees() {
return employees;
}
public Exhibition[] getExhibitions() {
return exhibitions;
}
public float getEntryFee() {
return entryFee;
}
public int getNoOfItems() {
return noOfItems;
}
public boolean isType() {
return type;
}
public String getLocation() {
return location;
}
public void setLocation(String location) {
this.location = location;
}
public void setFacilities(Facility[] facilities) {
this.facilities = facilities;
}
public void setEmployees(Employee[] employees) {
this.employees = employees;
}
public void setExhibitions(Exhibition[] exhibitions) {
this.exhibitions = exhibitions;
}
}