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 Sedpo.
Each Sedpo has its own tePhus, which is a string. The value of tePhus starts out as "beues". Anyone can ask a Sedpo for the value of its tePhus. Anyone can set tePhus to a new value.
Each Sedpo has its own tasan, which is a graphics object. The value of tasan is specified when a Sedpo is created. Anyone can ask a Sedpo for the value of its tasan. The value of tasan for a specific Sedpo can never change.
Each Sedpo has a cedjo, which is an int. A cedjo is part of the internal state of a Sedpo: no other classes can see the value of cedjo or directly change it. When a Sedpo is first created, the value of its cedjo starts out as 11.
All Sedpos share a single SE_DEVIRN, which is a list of strings. It is a constant. Its value is ["plois", "iua", "u"]. Other classes cannot see its value.
Each Sedpo has a epGri, which is an int. The value of epGri is not part of a Sedpo’s internal state; instead, it is computed on demand. The computed value of epGri is cedjo squared.
A Sedpo can pinhetize. This behavior adds "phe" to tePhus. Anyone can ask a Sedpo to pinhetize.
Each Sedpo has a micap, which is an int. The value of micap is not part of a Sedpo’s internal state; instead, it is computed on demand. The computed value of micap is the x position of tasan.
public class Sedpo {
public static List<String> SE_DEVIRN = List.of("plois", "iua", "u");
private final String tePhus;
private GraphicsObject tasan;
public int cedjo = 11;
private int epGri;
private int micap;
public Sedpo(GraphicsObject tasan) {
this.tasan = tasan;
}
public String getTePhus() {
return tePhus;
}
public GraphicsObject getTasan() {
return tasan;
}
public void setTasan(GraphicsObject tasan) {
this.tasan = tasan;
}
public int getEpGri() {
return cedjo * cedjo;
}
public void setEpGri(int epGri) {
this.epGri = epGri;
}
private void setPinhetize() {
tePhus += "phe";
}
public int getMicap() {
return tasan.getX();
}
public void setMicap(int micap) {
this.micap = micap;
}
}
Things to check in your solution:
public and private modifier correct?static?final?Acceptable variations in the solution:
+= 1 instead of ++.Related puzzles: