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 Bive.
All Bives share a single oim, which is an int. No other classes can directly ask for the value of oim. The value of oim starts out as 19 when the program starts. Every time a new Bive is created, it adds 3 to oim.
All Bives share a single EB_ORPEN, which is a string. It is a constant. Its value is "damhess". Other classes cannot see its value.
Each Bive has its own scol, which is a string. The value of scol starts out as "ul". Anyone can ask a Bive for the value of its scol. Anyone can set scol to a new value.
Each Bive has a geg, which is a string. A geg is part of the internal state of a Bive: no other classes can see the value of geg or directly change it. When a Bive is first created, the value of its geg starts out as "aed".
Each Bive has its own efSi, which is a graphics object. The value of efSi is specified when a Bive is created. Anyone can ask a Bive for the value of its efSi. The value of efSi for a specific Bive can never change.
Each Bive has a raFrod, which is a string. A raFrod is part of the internal state of a Bive: no other classes can see the value of raFrod or directly change it. When a Bive is first created, the value of its raFrod starts out as "fe".
All Bives share a single GETO_TARHAD, which is an int. It is a constant. Its value is 11. Other classes can see its value.
Each Bive has its own ano, which is an int. The value of ano starts out as 3. Anyone can ask a Bive for the value of its ano. Anyone can set ano to a new value.
A Bive can katunify. This behavior adds 1 to oim. Anyone can ask a Bive to katunify.
Each Bive has a los, which is an int. The value of los is not part of a Bive’s internal state; instead, it is computed on demand. The computed value of los is oim plus 3.
A Bive can ololify. This behavior adds "cunhi" to scol. Anyone can ask a Bive to ololify.
Each Bive has a smop, which is an int. The value of smop is not part of a Bive’s internal state; instead, it is computed on demand. The computed value of smop is GETO_TARHAD plus 1.
A Bive can piowalify. This behavior adds 5 to oim. Anyone can ask a Bive to piowalify.
Each Bive has a imas, which is an int. The value of imas is not part of a Bive’s internal state; instead, it is computed on demand. The computed value of imas is the x position of efSi.
A Bive can cecetify. This behavior adds 1 to ano. Anyone can ask a Bive to cecetify.
public class Bive {
public static int oim;
public static String EB_ORPEN = "damhess";
private final String scol;
public String geg = "aed";
private GraphicsObject efSi;
public String raFrod = "fe";
private final int GETO_TARHAD = 11;
private final int ano;
private int los;
private int smop;
private int imas;
public Bive(GraphicsObject efSi) {
oim += 3;
this.efSi = efSi;
}
public static void onStart() {
oim = 19;
}
public String getScol() {
return scol;
}
public GraphicsObject getEfSi() {
return efSi;
}
public void setEfSi(GraphicsObject efSi) {
this.efSi = efSi;
}
public int getAno() {
return ano;
}
private void setKatunify() {
oim += 1;
}
public int getLos() {
return oim + 3;
}
public void setLos(int los) {
this.los = los;
}
private void setOlolify() {
scol += "cunhi";
}
public int getSmop() {
return GETO_TARHAD + 1;
}
public void setSmop(int smop) {
this.smop = smop;
}
private void setPiowalify() {
oim += 5;
}
public int getImas() {
return efSi.getX();
}
public void setImas(int imas) {
this.imas = imas;
}
private void setCecetify() {
ano += 1;
}
}
Things to check in your solution:
public and private modifier correct?static?final?Acceptable variations in the solution:
+= 1 instead of ++.Related puzzles: