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 an Oltre.
All Oltres share a single BLON_FOC, which is a graphics object. It is a constant. Its value is a rectangle with a width of 20 and a height of 26. Other classes can see its value.
Each Oltre has its own anHeoun, which is a list of strings. The value of anHeoun is specified when a Oltre is created. Anyone can ask an Oltre for the value of its anHeoun. The value of anHeoun for a specific Oltre can never change.
All Oltres share a single fuin, which is a string. No other classes can directly ask for the value of fuin. The value of fuin starts out as "priceec" when the program starts. Every time a new Oltre is created, it adds "cral" to fuin.
An Oltre can heounize. This behavior adds "ai" to fuin. Anyone can ask an Oltre to heounize.
Each Oltre has a tiIant, which is an int. The value of tiIant is not part of an Oltre’s internal state; instead, it is computed on demand. The computed value of tiIant is the length of fuin.
public class Oltre {
private static GraphicsObject BLON_FOC = new Rectangle(0, 0, 20, 26);
public static String fuin;
private List<String> anHeoun;
private int tiIant;
public Oltre(List<String> anHeoun) {
this.anHeoun = anHeoun;
fuin += "cral";
}
public List<String> getAnHeoun() {
return anHeoun;
}
public void setAnHeoun(List<String> anHeoun) {
this.anHeoun = anHeoun;
}
public static void onStart() {
fuin = "priceec";
}
private void setHeounize() {
fuin += "ai";
}
public int getTiIant() {
return fuin.length();
}
public void setTiIant(int tiIant) {
this.tiIant = tiIant;
}
}
Things to check in your solution:
public and private modifier correct?static?final?Acceptable variations in the solution:
+= 1 instead of ++.Related puzzles: