We can now choose the interface of the class, through which the clients can make use of the objects of the class EncryptedText.
Specifically, for each functionality we have to define a public method that realizes it and determine its header.
This leads us to the following skeleton for the class EncryptedText:
public class EncryptedText {
// representation of the objects of the class
private int key;
private String text;
// constructor
public EncryptedText(String nonEncryptedText) {
...
}
public EncryptedText(String nonEncryptedText, int key) {
...
}
// other public methods
public String getEncryptedText() {
...
}
public String getDecryptedText(int key) {
...
}
public boolean isKey(int candidateKey) {
...
}
public void setKey(int key, int newKey) {
...
}
// possibly auxiliary methods
}