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 Doschlak.
All Doschlaks share a single VOCH_PLINHOST, which is a graphics object. It is a constant. Its value is an ellipse with a width of 24 and a height of 45. Other classes cannot see its value.
Each Doschlak has its own irTraun, which is a string. The value of irTraun is specified when a Doschlak is created. Anyone can ask a Doschlak for the value of its irTraun. The value of irTraun for a specific Doschlak can never change.
Each Doschlak has a gosda, which is a string. The value of gosda is not part of a Doschlak’s internal state; instead, it is computed on demand. The computed value of gosda is irTraun with two exclamation points appended.
public class Doschlak {
public static GraphicsObject VOCH_PLINHOST = new Ellipse(0, 0, 24, 45);
private String irTraun;
private String gosda;
public Doschlak(String irTraun) {
this.irTraun = irTraun;
}
public String getIrTraun() {
return irTraun;
}
public void setIrTraun(String irTraun) {
this.irTraun = irTraun;
}
public String getGosda() {
return irTraun + "!!";
}
public void setGosda(String gosda) {
this.gosda = gosda;
}
}
Things to check in your solution:
public and private modifier correct?static?final?Acceptable variations in the solution:
+= 1 instead of ++.Related puzzles: