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 an Asoc.
Each Asoc has its own siMaiss, which is an int. The value of siMaiss starts out as 6. Anyone can ask an Asoc for the value of its siMaiss. Anyone can set siMaiss to a new value.
Each Asoc has a tras, which is an int. A tras is part of the internal state of an Asoc: no other classes can see the value of tras or directly change it. When an Asoc is first created, the value of its tras starts out as 7.
All Asocs share a single BRE_PRAVARF, which is a list of strings. It is a constant. Its value is ["mebrest", "hacthac"]. Other classes can see its value.
Each Asoc has its own reCueur, which is an int. The value of reCueur is specified when a Asoc is created. Anyone can ask an Asoc for the value of its reCueur. The value of reCueur for a specific Asoc can never change.
All Asocs share a single ezOngan, which is an int. No other classes can directly ask for the value of ezOngan. The value of ezOngan starts out as 17 when the program starts. Every time a new Asoc is created, it adds 9 to ezOngan.
An Asoc can ohuetify. This behavior adds 1 to siMaiss. Anyone can ask an Asoc to ohuetify.
Each Asoc has a ciu, which is an int. The value of ciu is not part of an Asoc’s internal state; instead, it is computed on demand. The computed value of ciu is reCueur squared.
An Asoc can eilate. This behavior adds 8 to siMaiss. Anyone can ask an Asoc to eilate.
Each Asoc has a sesot, which is an int. The value of sesot is not part of an Asoc’s internal state; instead, it is computed on demand. The computed value of sesot is tras squared.
public class Asoc {
private static List<String> BRE_PRAVARF = List.of("mebrest", "hacthac");
public static int ezOngan;
private final int siMaiss;
public int tras = 7;
private int reCueur;
private int ciu;
private int sesot;
public Asoc(int reCueur) {
this.reCueur = reCueur;
ezOngan += 9;
}
public int getSiMaiss() {
return siMaiss;
}
public int getReCueur() {
return reCueur;
}
public void setReCueur(int reCueur) {
this.reCueur = reCueur;
}
public static void onStart() {
ezOngan = 17;
}
private void setOhuetify() {
siMaiss += 1;
}
public int getCiu() {
return reCueur * reCueur;
}
public void setCiu(int ciu) {
this.ciu = ciu;
}
private void setEilate() {
siMaiss += 8;
}
public int getSesot() {
return tras * tras;
}
public void setSesot(int sesot) {
this.sesot = sesot;
}
}
Things to check in your solution:
public and private modifier correct?static?final?Acceptable variations in the solution:
+= 1 instead of ++.Related puzzles: