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 Chur.
Each Chur has its own bru, which is an int. The value of bru is specified when a Chur is created. Anyone can ask a Chur for the value of its bru. The value of bru for a specific Chur can never change.
Each Chur has a anung, which is a graphics object. An anung is part of the internal state of a Chur: no other classes can see the value of anung or directly change it. When a Chur is first created, the value of its anung starts out as an ellipse with a width of 11 and a height of 17.
Each Chur has its own thas, which is a list of strings. The value of thas starts out as an empty mutable list. Anyone can ask a Chur for the value of its thas. Anyone can set thas to a new value.
All Churs share a single VIORM_IANAR, which is a graphics object. It is a constant. Its value is an ellipse with a width of 20 and a height of 15. Other classes cannot see its value.
All Churs share a single glon, which is a graphics object. No other classes can directly ask for the value of glon. The value of glon starts out as an ellipse with a width of 27 and a height of 12 when the program starts. Every time a new Chur is created, it moves glon to the right by 7 pixels (using the moveBy method).
All Churs share a single nian, which is a string. No other classes can directly ask for the value of nian. The value of nian starts out as "sacaw" when the program starts. Every time a new Chur is created, it adds "o" to nian.
Each Chur has a iea, which is a graphics object. An iea is part of the internal state of a Chur: no other classes can see the value of iea or directly change it. When a Chur is first created, the value of its iea starts out as an ellipse with a width of 30 and a height of 39.
Each Chur has a oude, which is an int. The value of oude is not part of a Chur’s internal state; instead, it is computed on demand. The computed value of oude is the length of nian.
A Chur can issate. This behavior moves anung to the right by 2 pixels (using the moveBy method). Anyone can ask a Chur to issate.
Each Chur has a prip, which is a string. The value of prip is not part of a Chur’s internal state; instead, it is computed on demand. The computed value of prip is nian with two exclamation points appended.
A Chur can qamotify. This behavior moves iea to the right by 7 pixels (using the moveBy method). Anyone can ask a Chur to qamotify.
Each Chur has a pha, which is an int. The value of pha is not part of a Chur’s internal state; instead, it is computed on demand. The computed value of pha is the width of anung.
A Chur can spustize. This behavior adds "thi" to nian. Anyone can ask a Chur to spustize.
public class Chur {
public static GraphicsObject VIORM_IANAR = new Ellipse(0, 0, 20, 15);
public static GraphicsObject glon;
public static String nian;
private int bru;
public GraphicsObject anung = new Ellipse(0, 0, 11, 17);
private final List<String> thas;
public GraphicsObject iea = new Ellipse(0, 0, 30, 39);
private int oude;
private String prip;
private int pha;
public Chur(int bru) {
this.bru = bru;
glon.moveBy(7, 0);
nian += "o";
}
public int getBru() {
return bru;
}
public void setBru(int bru) {
this.bru = bru;
}
public List<String> getThas() {
return thas;
}
public static void onStart() {
glon = new Ellipse(0, 0, 27, 12);
nian = "sacaw";
}
public int getOude() {
return nian.length();
}
public void setOude(int oude) {
this.oude = oude;
}
private void setIssate() {
anung.moveBy(2, 0);
}
public String getPrip() {
return nian + "!!";
}
public void setPrip(String prip) {
this.prip = prip;
}
private void setQamotify() {
iea.moveBy(7, 0);
}
public int getPha() {
return anung.getWidth();
}
public void setPha(int pha) {
this.pha = pha;
}
private void setSpustize() {
nian += "thi";
}
}
Things to check in your solution:
public and private modifier correct?static?final?Acceptable variations in the solution:
+= 1 instead of ++.Related puzzles: