Translate the specification below into an idiomatic Java class definition.
(In this context, "idiomatic" means following the common style and conventions of the language.)
One kind of thing that exists in our model is a Ponte.
All Pontes share a single DED_ASTDRIP, which is a graphics object. It is a constant. Its value is a rectangle with a width of 41 and a height of 26. Other classes cannot see its value.
Each Ponte has its own pao, which is a list of strings. The value of pao is specified when a Ponte is created. Anyone can ask a Ponte for the value of its pao. The value of pao for a specific Ponte can never change.
Each Ponte has a xeHemon, which is a string. A xeHemon is part of the internal state of a Ponte: no other classes can see the value of xeHemon or directly change it. When a Ponte is first created, the value of its xeHemon starts out as "rop".
Each Ponte has its own neadi, which is a graphics object. The value of neadi starts out as a rectangle with a width of 13 and a height of 16. Anyone can ask a Ponte for the value of its neadi. Anyone can set neadi to a new value.
Each Ponte has a armen, which is a string. The value of armen is not part of a Ponte’s internal state; instead, it is computed on demand. The computed value of armen is the first element of pao.
A Ponte can bialify. This behavior adds "changtwo" to xeHemon. Anyone can ask a Ponte to bialify.
A Ponte can crultize. This behavior adds "isosm" to xeHemon. Anyone can ask a Ponte to crultize.
public class Ponte {
public static GraphicsObject DED_ASTDRIP = new Rectangle(0, 0, 41, 26);
private List<String> pao;
public String xeHemon = "rop";
private final GraphicsObject neadi;
private String armen;
public Ponte(List<String> pao) {
this.pao = pao;
}
public List<String> getPao() {
return pao;
}
public void setPao(List<String> pao) {
this.pao = pao;
}
public GraphicsObject getNeadi() {
return neadi;
}
public String getArmen() {
return pao.get(0);
}
public void setArmen(String armen) {
this.armen = armen;
}
private void setBialify() {
xeHemon += "changtwo";
}
private void setCrultize() {
xeHemon += "isosm";
}
}
Things to check in your solution:
public and private modifier correct?static?final?Acceptable variations in the solution:
+= 1 instead of ++.Related puzzles: