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 Fiallar.
Each Fiallar has its own sti, which is a graphics object. The value of sti is specified when a Fiallar is created. Anyone can ask a Fiallar for the value of its sti. The value of sti for a specific Fiallar can never change.
All Fiallars share a single FRER_STUL, which is a string. It is a constant. Its value is "peunplung". Other classes cannot see its value.
Each Fiallar has a chul, which is a string. The value of chul is not part of a Fiallar’s internal state; instead, it is computed on demand. The computed value of chul is FRER_STUL with two exclamation points appended.
public class Fiallar {
public static String FRER_STUL = "peunplung";
private GraphicsObject sti;
private String chul;
public Fiallar(GraphicsObject sti) {
this.sti = sti;
}
public GraphicsObject getSti() {
return sti;
}
public void setSti(GraphicsObject sti) {
this.sti = sti;
}
public String getChul() {
return FRER_STUL + "!!";
}
public void setChul(String chul) {
this.chul = chul;
}
}
Things to check in your solution:
public and private modifier correct?static?final?Acceptable variations in the solution:
+= 1 instead of ++.Related puzzles: