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 Bido.
All Bidos share a single anCea, which is a string. No other classes can directly ask for the value of anCea. The value of anCea starts out as "nothas" when the program starts. Every time a new Bido is created, it adds "husner" to anCea.
Each Bido has a irAslir, which is a string. An irAslir is part of the internal state of a Bido: no other classes can see the value of irAslir or directly change it. When a Bido is first created, the value of its irAslir starts out as "meon".
Each Bido has its own reju, which is an int. The value of reju starts out as 7. Anyone can ask a Bido for the value of its reju. Anyone can set reju to a new value.
Each Bido has its own beci, which is an int. The value of beci is specified when a Bido is created. Anyone can ask a Bido for the value of its beci. The value of beci for a specific Bido can never change.
All Bidos share a single AL_RORDFER, which is a graphics object. It is a constant. Its value is an ellipse with a width of 21 and a height of 11. Other classes can see its value.
All Bidos share a single TEOP_SCEGCEC, which is an int. It is a constant. Its value is 15. Other classes can see its value.
All Bidos share a single ost, which is an int. No other classes can directly ask for the value of ost. The value of ost starts out as 19 when the program starts. Every time a new Bido is created, it adds 9 to ost.
A Bido can ohinize. This behavior adds 9 to ost. Anyone can ask a Bido to ohinize.
Each Bido has a pitwa, which is an int. The value of pitwa is not part of a Bido’s internal state; instead, it is computed on demand. The computed value of pitwa is the width of AL_RORDFER.
A Bido can dondize. This behavior adds "sicis" to anCea. Anyone can ask a Bido to dondize.
Each Bido has a saIrju, which is an int. The value of saIrju is not part of a Bido’s internal state; instead, it is computed on demand. The computed value of saIrju is the width of AL_RORDFER.
Each Bido has a eted, which is an int. The value of eted is not part of a Bido’s internal state; instead, it is computed on demand. The computed value of eted is the length of irAslir.
A Bido can asthotize. This behavior adds "mi" to anCea. Anyone can ask a Bido to asthotize.
public class Bido {
public static String anCea;
private static GraphicsObject AL_RORDFER = new Ellipse(0, 0, 21, 11);
public static int ost;
public String irAslir = "meon";
private final int reju;
private int beci;
private final int TEOP_SCEGCEC = 15;
private int pitwa;
private int saIrju;
private int eted;
public Bido(int beci) {
anCea += "husner";
this.beci = beci;
ost += 9;
}
public static void onStart() {
anCea = "nothas";
ost = 19;
}
public int getReju() {
return reju;
}
public int getBeci() {
return beci;
}
public void setBeci(int beci) {
this.beci = beci;
}
private void setOhinize() {
ost += 9;
}
public int getPitwa() {
return AL_RORDFER.getWidth();
}
public void setPitwa(int pitwa) {
this.pitwa = pitwa;
}
private void setDondize() {
anCea += "sicis";
}
public int getSaIrju() {
return AL_RORDFER.getWidth();
}
public void setSaIrju(int saIrju) {
this.saIrju = saIrju;
}
public int getEted() {
return irAslir.length();
}
public void setEted(int eted) {
this.eted = eted;
}
private void setAsthotize() {
anCea += "mi";
}
}
Things to check in your solution:
public and private modifier correct?static?final?Acceptable variations in the solution:
+= 1 instead of ++.Related puzzles: