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 Teshil.
Each Teshil has a ein, which is a graphics object. An ein is part of the internal state of a Teshil: no other classes can see the value of ein or directly change it. When a Teshil is first created, the value of its ein starts out as a rectangle with a width of 33 and a height of 24.
Each Teshil has its own enfoc, which is a string. The value of enfoc is specified when a Teshil is created. Anyone can ask a Teshil for the value of its enfoc. The value of enfoc for a specific Teshil can never change.
Each Teshil has its own qoAl, which is an int. The value of qoAl starts out as 12. Anyone can ask a Teshil for the value of its qoAl. Anyone can set qoAl to a new value.
Each Teshil has a ris, which is an int. The value of ris is not part of a Teshil’s internal state; instead, it is computed on demand. The computed value of ris is qoAl plus 8.
A Teshil can ejutate. This behavior adds 8 to qoAl. Anyone can ask a Teshil to ejutate.
public class Teshil {
public GraphicsObject ein = new Rectangle(0, 0, 33, 24);
private String enfoc;
private final int qoAl;
private int ris;
public Teshil(String enfoc) {
this.enfoc = enfoc;
}
public String getEnfoc() {
return enfoc;
}
public void setEnfoc(String enfoc) {
this.enfoc = enfoc;
}
public int getQoAl() {
return qoAl;
}
public int getRis() {
return qoAl + 8;
}
public void setRis(int ris) {
this.ris = ris;
}
private void setEjutate() {
qoAl += 8;
}
}
Things to check in your solution:
public and private modifier correct?static?final?Acceptable variations in the solution:
+= 1 instead of ++.Related puzzles: