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 KiaShencid.
All KiaShencids share a single CENG_RENG, which is a string. It is a constant. Its value is "eb". Other classes can see its value.
Each KiaShencid has its own saPrash, which is a string. The value of saPrash starts out as "i". Anyone can ask a KiaShencid for the value of its saPrash. Anyone can set saPrash to a new value.
Each KiaShencid has its own chref, which is an int. The value of chref is specified when a KiaShencid is created. Anyone can ask a KiaShencid for the value of its chref. The value of chref for a specific KiaShencid can never change.
Each KiaShencid has a oxSpod, which is an int. An oxSpod is part of the internal state of a KiaShencid: no other classes can see the value of oxSpod or directly change it. When a KiaShencid is first created, the value of its oxSpod starts out as 8.
All KiaShencids share a single piSihel, which is a list of strings. No other classes can directly ask for the value of piSihel. The value of piSihel starts out as an empty mutable list when the program starts. Every time a new KiaShencid is created, it adds "hontkiac" to piSihel.
Each KiaShencid has a chril, which is an int. A chril is part of the internal state of a KiaShencid: no other classes can see the value of chril or directly change it. When a KiaShencid is first created, the value of its chril starts out as 14.
Each KiaShencid has its own sism, which is a graphics object. The value of sism starts out as a rectangle with a width of 34 and a height of 41. Anyone can ask a KiaShencid for the value of its sism. Anyone can set sism to a new value.
All KiaShencids share a single IANFAS, which is an int. It is a constant. Its value is 6. Other classes can see its value.
Each KiaShencid has a bebra, which is an int. The value of bebra is not part of a KiaShencid’s internal state; instead, it is computed on demand. The computed value of bebra is the length of CENG_RENG.
A KiaShencid can thinify. This behavior adds "ar" to saPrash. Anyone can ask a KiaShencid to thinify.
Each KiaShencid has a stach, which is an int. The value of stach is not part of a KiaShencid’s internal state; instead, it is computed on demand. The computed value of stach is chril squared.
A KiaShencid can apaulize. This behavior adds 8 to chril. Anyone can ask a KiaShencid to apaulize.
Each KiaShencid has a adhu, which is an int. The value of adhu is not part of a KiaShencid’s internal state; instead, it is computed on demand. The computed value of adhu is chref plus 7.
A KiaShencid can mikize. This behavior moves sism to the right by 5 pixels (using the moveBy method). Anyone can ask a KiaShencid to mikize.
Each KiaShencid has a ioDorhi, which is an int. The value of ioDorhi is not part of a KiaShencid’s internal state; instead, it is computed on demand. The computed value of ioDorhi is chref plus 6.
public class KiaShencid {
private static String CENG_RENG = "eb";
public static List<String> piSihel;
private final String saPrash;
private int chref;
public int oxSpod = 8;
public int chril = 14;
private final GraphicsObject sism;
private final int IANFAS = 6;
private int bebra;
private int stach;
private int adhu;
private int ioDorhi;
public KiaShencid(int chref) {
this.chref = chref;
piSihel.add("hontkiac");
}
public String getSaPrash() {
return saPrash;
}
public int getChref() {
return chref;
}
public void setChref(int chref) {
this.chref = chref;
}
public static void onStart() {
piSihel = new ArrayList<>();
}
public GraphicsObject getSism() {
return sism;
}
public int getBebra() {
return CENG_RENG.length();
}
public void setBebra(int bebra) {
this.bebra = bebra;
}
private void setThinify() {
saPrash += "ar";
}
public int getStach() {
return chril * chril;
}
public void setStach(int stach) {
this.stach = stach;
}
private void setApaulize() {
chril += 8;
}
public int getAdhu() {
return chref + 7;
}
public void setAdhu(int adhu) {
this.adhu = adhu;
}
private void setMikize() {
sism.moveBy(5, 0);
}
public int getIoDorhi() {
return chref + 6;
}
public void setIoDorhi(int ioDorhi) {
this.ioDorhi = ioDorhi;
}
}
Things to check in your solution:
public and private modifier correct?static?final?Acceptable variations in the solution:
+= 1 instead of ++.Related puzzles: