-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathBank.java
More file actions
36 lines (28 loc) · 876 Bytes
/
Bank.java
File metadata and controls
36 lines (28 loc) · 876 Bytes
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
public class Bank
{
private String name;
private Car car;
private Ferry ferry;
public Bank(String newName)
{
name = newName;
}
public void print()
{
if (car == null)
System.out.println("There is no car at \'" + getName() + "\'");
else
System.out.println("There is a car at \'" + getName() + "\': \'" + car.getName() + "\'");
if (ferry == null)
System.out.println("There is no ferry at \'" + getName() + "\'");
else
System.out.println("There is a ferry at \'" + getName() + "\': \'" + ferry.getName() + "\'");
System.out.println("");
}
public String getName() { return name; }
public void setName(String newName) { name = newName; }
public Car getCar() { return car; }
public void setCar(Car newCar) {car = newCar; }
public Ferry getFerry() { return ferry; }
public void setFerry(Ferry newFerry) { ferry = newFerry; }
}