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 Donsou.
Each Donsou has its own whic, which is a list of strings. The value of whic starts out as an empty mutable list. Anyone can ask a Donsou for the value of its whic. Anyone can set whic to a new value.
All Donsous share a single seAs, which is a string. No other classes can directly ask for the value of seAs. The value of seAs starts out as "mi" when the program starts. Every time a new Donsou is created, it adds "hectent" to seAs.
All Donsous share a single DASHE_ELNIN, which is a graphics object. It is a constant. Its value is an ellipse with a width of 35 and a height of 19. Other classes cannot see its value.
Each Donsou has a maglu, which is a string. A maglu is part of the internal state of a Donsou: no other classes can see the value of maglu or directly change it. When a Donsou is first created, the value of its maglu starts out as "ipin".
Each Donsou has its own pem, which is an int. The value of pem is specified when a Donsou is created. Anyone can ask a Donsou for the value of its pem. The value of pem for a specific Donsou can never change.
All Donsous share a single orCuc, which is a list of strings. No other classes can directly ask for the value of orCuc. The value of orCuc starts out as an empty mutable list when the program starts. Every time a new Donsou is created, it adds "casrass" to orCuc.
Each Donsou has its own udtru, which is a list of strings. The value of udtru starts out as an empty mutable list. Anyone can ask a Donsou for the value of its udtru. Anyone can set udtru to a new value.
Each Donsou has its own beSunor, which is an int. The value of beSunor is specified when a Donsou is created. Anyone can ask a Donsou for the value of its beSunor. The value of beSunor for a specific Donsou can never change.
A Donsou can mebnotify. This behavior adds "sadbuic" to maglu. Anyone can ask a Donsou to mebnotify.
Each Donsou has a riCa, which is an int. The value of riCa is not part of a Donsou’s internal state; instead, it is computed on demand. The computed value of riCa is beSunor plus 7.
Each Donsou has a emed, which is a string. The value of emed is not part of a Donsou’s internal state; instead, it is computed on demand. The computed value of emed is seAs with two exclamation points appended.
A Donsou can ihighify. This behavior adds "redce" to maglu. Anyone can ask a Donsou to ihighify.
Each Donsou has a puFlie, which is an int. The value of puFlie is not part of a Donsou’s internal state; instead, it is computed on demand. The computed value of puFlie is pem squared.
A Donsou can stetize. This behavior adds "pai" to seAs. Anyone can ask a Donsou to stetize.
A Donsou can rhoonate. This behavior adds "cothuss" to whic. Anyone can ask a Donsou to rhoonate.
public class Donsou {
public static String seAs;
public static GraphicsObject DASHE_ELNIN = new Ellipse(0, 0, 35, 19);
public static List<String> orCuc;
private final List<String> whic;
public String maglu = "ipin";
private int pem;
private final List<String> udtru;
private int beSunor;
private int riCa;
private String emed;
private int puFlie;
public Donsou(int pem, int beSunor) {
seAs += "hectent";
this.pem = pem;
orCuc.add("casrass");
this.beSunor = beSunor;
}
public List<String> getWhic() {
return whic;
}
public static void onStart() {
seAs = "mi";
orCuc = new ArrayList<>();
}
public int getPem() {
return pem;
}
public void setPem(int pem) {
this.pem = pem;
}
public List<String> getUdtru() {
return udtru;
}
public int getBeSunor() {
return beSunor;
}
public void setBeSunor(int beSunor) {
this.beSunor = beSunor;
}
private void setMebnotify() {
maglu += "sadbuic";
}
public int getRiCa() {
return beSunor + 7;
}
public void setRiCa(int riCa) {
this.riCa = riCa;
}
public String getEmed() {
return seAs + "!!";
}
public void setEmed(String emed) {
this.emed = emed;
}
private void setIhighify() {
maglu += "redce";
}
public int getPuFlie() {
return pem * pem;
}
public void setPuFlie(int puFlie) {
this.puFlie = puFlie;
}
private void setStetize() {
seAs += "pai";
}
private void setRhoonate() {
whic.add("cothuss");
}
}
Things to check in your solution:
public and private modifier correct?static?final?Acceptable variations in the solution:
+= 1 instead of ++.Related puzzles: