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 Stil.
Each Stil has a koNe, which is a string. A koNe is part of the internal state of a Stil: no other classes can see the value of koNe or directly change it. When a Stil is first created, the value of its koNe starts out as "esssis".
Each Stil has its own dicti, which is a string. The value of dicti is specified when a Stil is created. Anyone can ask a Stil for the value of its dicti. The value of dicti for a specific Stil can never change.
All Stils share a single TRONS_HOSSQEN, which is a list of strings. It is a constant. Its value is ["madvar", "mo"]. Other classes cannot see its value.
Each Stil has its own kiBe, which is a string. The value of kiBe starts out as "ec". Anyone can ask a Stil for the value of its kiBe. Anyone can set kiBe to a new value.
Each Stil has a ang, which is a string. The value of ang is not part of a Stil’s internal state; instead, it is computed on demand. The computed value of ang is kiBe with two exclamation points appended.
A Stil can cocate. This behavior adds "rito" to kiBe. Anyone can ask a Stil to cocate.
A Stil can prilify. This behavior adds "jana" to koNe. Anyone can ask a Stil to prilify.
public class Stil {
public static List<String> TRONS_HOSSQEN = List.of("madvar", "mo");
public String koNe = "esssis";
private String dicti;
private final String kiBe;
private String ang;
public Stil(String dicti) {
this.dicti = dicti;
}
public String getDicti() {
return dicti;
}
public void setDicti(String dicti) {
this.dicti = dicti;
}
public String getKiBe() {
return kiBe;
}
public String getAng() {
return kiBe + "!!";
}
public void setAng(String ang) {
this.ang = ang;
}
private void setCocate() {
kiBe += "rito";
}
private void setPrilify() {
koNe += "jana";
}
}
Things to check in your solution:
public and private modifier correct?static?final?Acceptable variations in the solution:
+= 1 instead of ++.Related puzzles: