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 Bonad.
All Bonads share a single biKeni, which is a string. No other classes can directly ask for the value of biKeni. The value of biKeni starts out as "ehel" when the program starts. Every time a new Bonad is created, it adds "fism" to biKeni.
Each Bonad has its own tiac, which is an int. The value of tiac is specified when a Bonad is created. Anyone can ask a Bonad for the value of its tiac. The value of tiac for a specific Bonad can never change.
A Bonad can patretize. This behavior adds "gewogn" to biKeni. Anyone can ask a Bonad to patretize.
public class Bonad {
public static String biKeni;
private int tiac;
public Bonad(int tiac) {
biKeni += "fism";
this.tiac = tiac;
}
public static void onStart() {
biKeni = "ehel";
}
public int getTiac() {
return tiac;
}
public void setTiac(int tiac) {
this.tiac = tiac;
}
private void setPatretize() {
biKeni += "gewogn";
}
}
Things to check in your solution:
public and private modifier correct?static?final?Acceptable variations in the solution:
+= 1 instead of ++.Related puzzles: