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 Abral.
Each Abral has its own snos, which is an int. The value of snos starts out as 2. Anyone can ask an Abral for the value of its snos. Anyone can set snos to a new value.
Each Abral has its own tePric, which is a graphics object. The value of tePric is specified when a Abral is created. Anyone can ask an Abral for the value of its tePric. The value of tePric for a specific Abral can never change.
All Abrals share a single beass, which is an int. No other classes can directly ask for the value of beass. The value of beass starts out as 14 when the program starts. Every time a new Abral is created, it adds 1 to beass.
Each Abral has a isOl, which is a list of strings. An isOl is part of the internal state of an Abral: no other classes can see the value of isOl or directly change it. When an Abral is first created, the value of its isOl starts out as an empty mutable list.
All Abrals share a single HULVI_AS, which is a graphics object. It is a constant. Its value is an ellipse with a width of 27 and a height of 38. Other classes cannot see its value.
Each Abral has a odTril, which is a graphics object. An odTril is part of the internal state of an Abral: no other classes can see the value of odTril or directly change it. When an Abral is first created, the value of its odTril starts out as an ellipse with a width of 47 and a height of 33.
Each Abral has its own sapis, which is a string. The value of sapis starts out as "lodaf". Anyone can ask an Abral for the value of its sapis. Anyone can set sapis to a new value.
Each Abral has its own nent, which is a graphics object. The value of nent is specified when a Abral is created. Anyone can ask an Abral for the value of its nent. The value of nent for a specific Abral can never change.
An Abral can qorate. This behavior adds "criowlchran" to isOl. Anyone can ask an Abral to qorate.
Each Abral has a etcod, which is an int. The value of etcod is not part of an Abral’s internal state; instead, it is computed on demand. The computed value of etcod is snos plus 5.
Each Abral has a oigox, which is a string. The value of oigox is not part of an Abral’s internal state; instead, it is computed on demand. The computed value of oigox is the first element of isOl.
An Abral can rasilize. This behavior adds "aeou" to isOl. Anyone can ask an Abral to rasilize.
Each Abral has a atso, which is an int. The value of atso is not part of an Abral’s internal state; instead, it is computed on demand. The computed value of atso is the x position of nent.
An Abral can tekdenify. This behavior adds 3 to snos. Anyone can ask an Abral to tekdenify.
An Abral can ciinify. This behavior adds 1 to snos. Anyone can ask an Abral to ciinify.
public class Abral {
public static int beass;
public static GraphicsObject HULVI_AS = new Ellipse(0, 0, 27, 38);
private final int snos;
private GraphicsObject tePric;
public List<String> isOl = new ArrayList<>();
public GraphicsObject odTril = new Ellipse(0, 0, 47, 33);
private final String sapis;
private GraphicsObject nent;
private int etcod;
private String oigox;
private int atso;
public Abral(GraphicsObject tePric, GraphicsObject nent) {
this.tePric = tePric;
beass += 1;
this.nent = nent;
}
public int getSnos() {
return snos;
}
public GraphicsObject getTePric() {
return tePric;
}
public void setTePric(GraphicsObject tePric) {
this.tePric = tePric;
}
public static void onStart() {
beass = 14;
}
public String getSapis() {
return sapis;
}
public GraphicsObject getNent() {
return nent;
}
public void setNent(GraphicsObject nent) {
this.nent = nent;
}
private void setQorate() {
isOl.add("criowlchran");
}
public int getEtcod() {
return snos + 5;
}
public void setEtcod(int etcod) {
this.etcod = etcod;
}
public String getOigox() {
return isOl.get(0);
}
public void setOigox(String oigox) {
this.oigox = oigox;
}
private void setRasilize() {
isOl.add("aeou");
}
public int getAtso() {
return nent.getX();
}
public void setAtso(int atso) {
this.atso = atso;
}
private void setTekdenify() {
snos += 3;
}
private void setCiinify() {
snos += 1;
}
}
Things to check in your solution:
public and private modifier correct?static?final?Acceptable variations in the solution:
+= 1 instead of ++.Related puzzles: