-
Notifications
You must be signed in to change notification settings - Fork 0
/
Student.java
46 lines (40 loc) · 1.17 KB
/
Student.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
class Student implements EducationalInstitution {
private String name;
public University university;
private double balance;
public Student(String name, double balance, University university) {
this.name = name;
this.balance = balance;
if (balance >= university.tuitionFee) {
this.university = university;
}
else {
System.out.println("Not Enough Balance");
this.university = null;
}
}
@Override
public void displayInfo() {
System.out.println("Name: " + name);
System.out.println("University: " + university.name);
System.out.println("Balance: " + balance);
}
public String getName() {
return name;
}
public void setBalance(double balance){
this.balance = balance;
}
public void setName(String name) {
this.name = name;
}
public void setUniversity(University university){
this.university = university;
}
public University getUniversity() {
return university;
}
public double getBalance() {
return balance;
}
}