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 Setoc.
Each Setoc has its own gri, which is a string. The value of gri is specified when a Setoc is created. Anyone can ask a Setoc for the value of its gri. The value of gri for a specific Setoc can never change.
All Setocs share a single AS_NAOL, which is a graphics object. It is a constant. Its value is a rectangle with a width of 41 and a height of 44. Other classes cannot see its value.
Each Setoc has a baWheol, which is a graphics object. A baWheol is part of the internal state of a Setoc: no other classes can see the value of baWheol or directly change it. When a Setoc is first created, the value of its baWheol starts out as a rectangle with a width of 24 and a height of 39.
Each Setoc has its own daa, which is a string. The value of daa starts out as "neag". Anyone can ask a Setoc for the value of its daa. Anyone can set daa to a new value.
A Setoc can phelize. This behavior adds "hacto" to daa. Anyone can ask a Setoc to phelize.
Each Setoc has a pomna, which is a string. The value of pomna is not part of a Setoc’s internal state; instead, it is computed on demand. The computed value of pomna is gri with two exclamation points appended.
A Setoc can ulosify. This behavior adds "oolval" to daa. Anyone can ask a Setoc to ulosify.
public class Setoc {
public static GraphicsObject AS_NAOL = new Rectangle(0, 0, 41, 44);
private String gri;
public GraphicsObject baWheol = new Rectangle(0, 0, 24, 39);
private final String daa;
private String pomna;
public Setoc(String gri) {
this.gri = gri;
}
public String getGri() {
return gri;
}
public void setGri(String gri) {
this.gri = gri;
}
public String getDaa() {
return daa;
}
private void setPhelize() {
daa += "hacto";
}
public String getPomna() {
return gri + "!!";
}
public void setPomna(String pomna) {
this.pomna = pomna;
}
private void setUlosify() {
daa += "oolval";
}
}
Things to check in your solution:
public and private modifier correct?static?final?Acceptable variations in the solution:
+= 1 instead of ++.Related puzzles: