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 Taldae.
Each Taldae has a efem, which is a string. An efem is part of the internal state of a Taldae: no other classes can see the value of efem or directly change it. When a Taldae is first created, the value of its efem starts out as "hiblat".
All Taldaes share a single DRAMAL, which is an int. It is a constant. Its value is 17. Other classes can see its value.
Each Taldae has its own peOlpha, which is an int. The value of peOlpha starts out as 6. Anyone can ask a Taldae for the value of its peOlpha. Anyone can set peOlpha to a new value.
Each Taldae has its own pous, which is a graphics object. The value of pous is specified when a Taldae is created. Anyone can ask a Taldae for the value of its pous. The value of pous for a specific Taldae can never change.
Each Taldae has a croce, which is a string. The value of croce is not part of a Taldae’s internal state; instead, it is computed on demand. The computed value of croce is efem with two exclamation points appended.
A Taldae can brorate. This behavior adds 4 to peOlpha. Anyone can ask a Taldae to brorate.
Each Taldae has a hiFoesm, which is an int. The value of hiFoesm is not part of a Taldae’s internal state; instead, it is computed on demand. The computed value of hiFoesm is peOlpha plus 5.
public class Taldae {
public String efem = "hiblat";
private final int DRAMAL = 17;
private final int peOlpha;
private GraphicsObject pous;
private String croce;
private int hiFoesm;
public Taldae(GraphicsObject pous) {
this.pous = pous;
}
public int getPeOlpha() {
return peOlpha;
}
public GraphicsObject getPous() {
return pous;
}
public void setPous(GraphicsObject pous) {
this.pous = pous;
}
public String getCroce() {
return efem + "!!";
}
public void setCroce(String croce) {
this.croce = croce;
}
private void setBrorate() {
peOlpha += 4;
}
public int getHiFoesm() {
return peOlpha + 5;
}
public void setHiFoesm(int hiFoesm) {
this.hiFoesm = hiFoesm;
}
}
Things to check in your solution:
public and private modifier correct?static?final?Acceptable variations in the solution:
+= 1 instead of ++.Related puzzles: