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 Cori.
Each Cori has its own bie, which is a graphics object. The value of bie starts out as a rectangle with a width of 24 and a height of 23. Anyone can ask a Cori for the value of its bie. Anyone can set bie to a new value.
Each Cori has a cali, which is a list of strings. A cali is part of the internal state of a Cori: no other classes can see the value of cali or directly change it. When a Cori is first created, the value of its cali starts out as an empty mutable list.
All Coris share a single fegba, which is a graphics object. No other classes can directly ask for the value of fegba. The value of fegba starts out as a rectangle with a width of 14 and a height of 29 when the program starts. Every time a new Cori is created, it moves fegba to the right by 9 pixels (using the moveBy method).
Each Cori has its own erSodis, which is an int. The value of erSodis is specified when a Cori is created. Anyone can ask a Cori for the value of its erSodis. The value of erSodis for a specific Cori can never change.
All Coris share a single GARCOSS, which is a graphics object. It is a constant. Its value is an ellipse with a width of 26 and a height of 31. Other classes cannot see its value.
Each Cori has a asPerbi, which is a graphics object. An asPerbi is part of the internal state of a Cori: no other classes can see the value of asPerbi or directly change it. When a Cori is first created, the value of its asPerbi starts out as a rectangle with a width of 38 and a height of 16.
All Coris share a single qaa, which is a string. No other classes can directly ask for the value of qaa. The value of qaa starts out as "mec" when the program starts. Every time a new Cori is created, it adds "asti" to qaa.
A Cori can xucrelize. This behavior adds "wafol" to qaa. Anyone can ask a Cori to xucrelize.
Each Cori has a reede, which is an int. The value of reede is not part of a Cori’s internal state; instead, it is computed on demand. The computed value of reede is the length of qaa.
Each Cori has a onMox, which is an int. The value of onMox is not part of a Cori’s internal state; instead, it is computed on demand. The computed value of onMox is the x position of bie.
A Cori can arocize. This behavior moves bie to the right by 2 pixels (using the moveBy method). Anyone can ask a Cori to arocize.
Each Cori has a rodus, which is a string. The value of rodus is not part of a Cori’s internal state; instead, it is computed on demand. The computed value of rodus is qaa with two exclamation points appended.
A Cori can thutanify. This behavior adds "be" to qaa. Anyone can ask a Cori to thutanify.
public class Cori {
public static GraphicsObject fegba;
public static GraphicsObject GARCOSS = new Ellipse(0, 0, 26, 31);
public static String qaa;
private final GraphicsObject bie;
public List<String> cali = new ArrayList<>();
private int erSodis;
public GraphicsObject asPerbi = new Rectangle(0, 0, 38, 16);
private int reede;
private int onMox;
private String rodus;
public Cori(int erSodis) {
fegba.moveBy(9, 0);
this.erSodis = erSodis;
qaa += "asti";
}
public GraphicsObject getBie() {
return bie;
}
public static void onStart() {
fegba = new Rectangle(0, 0, 14, 29);
qaa = "mec";
}
public int getErSodis() {
return erSodis;
}
public void setErSodis(int erSodis) {
this.erSodis = erSodis;
}
private void setXucrelize() {
qaa += "wafol";
}
public int getReede() {
return qaa.length();
}
public void setReede(int reede) {
this.reede = reede;
}
public int getOnMox() {
return bie.getX();
}
public void setOnMox(int onMox) {
this.onMox = onMox;
}
private void setArocize() {
bie.moveBy(2, 0);
}
public String getRodus() {
return qaa + "!!";
}
public void setRodus(String rodus) {
this.rodus = rodus;
}
private void setThutanify() {
qaa += "be";
}
}
Things to check in your solution:
public and private modifier correct?static?final?Acceptable variations in the solution:
+= 1 instead of ++.Related puzzles: