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 Maall.
All Maalls share a single ecef, which is a string. No other classes can directly ask for the value of ecef. The value of ecef starts out as "bir" when the program starts. Every time a new Maall is created, it adds "swulhec" to ecef.
Each Maall has a pexti, which is a graphics object. A pexti is part of the internal state of a Maall: no other classes can see the value of pexti or directly change it. When a Maall is first created, the value of its pexti starts out as an ellipse with a width of 44 and a height of 35.
Each Maall has its own emLasan, which is an int. The value of emLasan is specified when a Maall is created. Anyone can ask a Maall for the value of its emLasan. The value of emLasan for a specific Maall can never change.
Each Maall has a tof, which is an int. The value of tof is not part of a Maall’s internal state; instead, it is computed on demand. The computed value of tof is emLasan squared.
A Maall can stiwnize. This behavior moves pexti to the right by 5 pixels (using the moveBy method). Anyone can ask a Maall to stiwnize.
public class Maall {
public static String ecef;
public GraphicsObject pexti = new Ellipse(0, 0, 44, 35);
private int emLasan;
private int tof;
public Maall(int emLasan) {
ecef += "swulhec";
this.emLasan = emLasan;
}
public static void onStart() {
ecef = "bir";
}
public int getEmLasan() {
return emLasan;
}
public void setEmLasan(int emLasan) {
this.emLasan = emLasan;
}
public int getTof() {
return emLasan * emLasan;
}
public void setTof(int tof) {
this.tof = tof;
}
private void setStiwnize() {
pexti.moveBy(5, 0);
}
}
Things to check in your solution:
public and private modifier correct?static?final?Acceptable variations in the solution:
+= 1 instead of ++.Related puzzles: