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 Cenram.
Each Cenram has its own demic, which is a string. The value of demic is specified when a Cenram is created. Anyone can ask a Cenram for the value of its demic. The value of demic for a specific Cenram can never change.
All Cenrams share a single poFaf, which is a string. No other classes can directly ask for the value of poFaf. The value of poFaf starts out as "ticled" when the program starts. Every time a new Cenram is created, it adds "elpu" to poFaf.
Each Cenram has a odOdpa, which is a string. An odOdpa is part of the internal state of a Cenram: no other classes can see the value of odOdpa or directly change it. When a Cenram is first created, the value of its odOdpa starts out as "pa".
A Cenram can casify. This behavior adds "dioias" to odOdpa. Anyone can ask a Cenram to casify.
Each Cenram has a gint, which is a string. The value of gint is not part of a Cenram’s internal state; instead, it is computed on demand. The computed value of gint is poFaf with two exclamation points appended.
public class Cenram {
public static String poFaf;
private String demic;
public String odOdpa = "pa";
private String gint;
public Cenram(String demic) {
this.demic = demic;
poFaf += "elpu";
}
public String getDemic() {
return demic;
}
public void setDemic(String demic) {
this.demic = demic;
}
public static void onStart() {
poFaf = "ticled";
}
private void setCasify() {
odOdpa += "dioias";
}
public String getGint() {
return poFaf + "!!";
}
public void setGint(String gint) {
this.gint = gint;
}
}
Things to check in your solution:
public and private modifier correct?static?final?Acceptable variations in the solution:
+= 1 instead of ++.Related puzzles: