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 Hian.
All Hians share a single DRUNGSEAN, which is a string. It is a constant. Its value is "si". Other classes can see its value.
Each Hian has its own fuan, which is a string. The value of fuan starts out as "a". Anyone can ask a Hian for the value of its fuan. Anyone can set fuan to a new value.
Each Hian has a esMaseo, which is a string. The value of esMaseo is not part of a Hian’s internal state; instead, it is computed on demand. The computed value of esMaseo is DRUNGSEAN with two exclamation points appended.
public class Hian {
private static String DRUNGSEAN = "si";
private final String fuan;
private String esMaseo;
public Hian() {
}
public String getFuan() {
return fuan;
}
public String getEsMaseo() {
return DRUNGSEAN + "!!";
}
public void setEsMaseo(String esMaseo) {
this.esMaseo = esMaseo;
}
}
Things to check in your solution:
public and private modifier correct?static?final?Acceptable variations in the solution:
+= 1 instead of ++.Related puzzles: