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 Jecstis.
All Jecstiss share a single EC_PHA, which is a list of strings. It is a constant. Its value is ["il", "pser"]. Other classes cannot see its value.
All Jecstiss share a single hoiph, which is an int. No other classes can directly ask for the value of hoiph. The value of hoiph starts out as 10 when the program starts. Every time a new Jecstis is created, it adds 5 to hoiph.
Each Jecstis has a iack, which is an int. The value of iack is not part of a Jecstis’s internal state; instead, it is computed on demand. The computed value of iack is hoiph squared.
public class Jecstis {
public static List<String> EC_PHA = List.of("il", "pser");
public static int hoiph;
private int iack;
public Jecstis() {
hoiph += 5;
}
public static void onStart() {
hoiph = 10;
}
public int getIack() {
return hoiph * hoiph;
}
public void setIack(int iack) {
this.iack = iack;
}
}
Things to check in your solution:
public and private modifier correct?static?final?Acceptable variations in the solution:
+= 1 instead of ++.Related puzzles: