We have to decide how to represent the properties of encrypted texts. Note that an encrypted text needs two properties: the text itself and the encryption key. Let us represent the objects of the class EncryptedText by means of the following instance variables:
At this point we can write:
public class EncryptedText {
// representation of the objects of the class
private int key;
private String text;
// public methods that realize the requested functionalities
// possibly auxiliary methods
}