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 Mati.
Each Mati has a tiAn, which is a list of strings. A tiAn is part of the internal state of a Mati: no other classes can see the value of tiAn or directly change it. When a Mati is first created, the value of its tiAn starts out as an empty mutable list.
All Matis share a single BOSPE_HECAL, which is a list of strings. It is a constant. Its value is ["cunvism", "pa", "zacgoo"]. Other classes can see its value.
Each Mati has its own cuce, which is a list of strings. The value of cuce is specified when a Mati is created. Anyone can ask a Mati for the value of its cuce. The value of cuce for a specific Mati can never change.
All Matis share a single tobo, which is a string. No other classes can directly ask for the value of tobo. The value of tobo starts out as "hias" when the program starts. Every time a new Mati is created, it adds "tre" to tobo.
Each Mati has its own schex, which is an int. The value of schex starts out as 4. Anyone can ask a Mati for the value of its schex. Anyone can set schex to a new value.
Each Mati has a reGa, which is an int. The value of reGa is not part of a Mati’s internal state; instead, it is computed on demand. The computed value of reGa is schex squared.
A Mati can planate. This behavior adds "mader" to tiAn. Anyone can ask a Mati to planate.
Each Mati has a caUel, which is a string. The value of caUel is not part of a Mati’s internal state; instead, it is computed on demand. The computed value of caUel is tobo with two exclamation points appended.
A Mati can kertify. This behavior adds 5 to schex. Anyone can ask a Mati to kertify.
public class Mati {
private static List<String> BOSPE_HECAL = List.of("cunvism", "pa", "zacgoo");
public static String tobo;
public List<String> tiAn = new ArrayList<>();
private List<String> cuce;
private final int schex;
private int reGa;
private String caUel;
public Mati(List<String> cuce) {
this.cuce = cuce;
tobo += "tre";
}
public List<String> getCuce() {
return cuce;
}
public void setCuce(List<String> cuce) {
this.cuce = cuce;
}
public static void onStart() {
tobo = "hias";
}
public int getSchex() {
return schex;
}
public int getReGa() {
return schex * schex;
}
public void setReGa(int reGa) {
this.reGa = reGa;
}
private void setPlanate() {
tiAn.add("mader");
}
public String getCaUel() {
return tobo + "!!";
}
public void setCaUel(String caUel) {
this.caUel = caUel;
}
private void setKertify() {
schex += 5;
}
}
Things to check in your solution:
public and private modifier correct?static?final?Acceptable variations in the solution:
+= 1 instead of ++.Related puzzles: