class Account {
public String PIN;
public String name;
public int balance = 0;
}
interface CardUse {
public int read(String PIN);
public void reduceBy(int amount, String PIN);
}
class BankCard implements CardUse {
private int usage = 0;
private String owner;
private Bank bank;
public int read(String PIN) {...}
public void reduceBy(int amount, String PIN) {...}
}
class Bank {
private Account [] accounts = new Account [10];
private int number = 0;
private Account findAccount(String name, String PIN) {...}
public int getBalance(String PIN, String name) { ... }
public String createAccount(String name, int startAmount) { ... }
public CardUse getBankCard(String name, String PIN) { ... }
}
In the public transport system we find a transport vehicle. The transport vehicle can move a certain amount of people (with a maximum capacity) from location A to location B, but we do not know how this is done (it is abstract!); the transport vehicle may be standing at a location or it may be moving to a certain other location until it arrives at its destination. When it stands people may enter or leave the vehicle; never more people than the maximum capacity may be in the vehicle. We will never find a pure transport device in reality. A bus is a special transport device that moves on land, a boat is a transport device that moves on water. Both move at a maximum speed (for the car in km/h, for the boat on knots). The boat has a draught (how deep the water needs to be so that it can move). The bus has two doors that may be openend or closed. An amphibious bus is as well a bus as a boat.
| ge.schroeder, jan-1999 |