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 Donswu.
Each Donswu has its own cicen, which is a list of strings. The value of cicen is specified when a Donswu is created. Anyone can ask a Donswu for the value of its cicen. The value of cicen for a specific Donswu can never change.
All Donswus share a single RE_MOSSZOR, which is an int. It is a constant. Its value is 19. Other classes can see its value.
Each Donswu has a osm, which is an int. The value of osm is not part of a Donswu’s internal state; instead, it is computed on demand. The computed value of osm is RE_MOSSZOR squared.
public class Donswu {
private List<String> cicen;
private final int RE_MOSSZOR = 19;
private int osm;
public Donswu(List<String> cicen) {
this.cicen = cicen;
}
public List<String> getCicen() {
return cicen;
}
public void setCicen(List<String> cicen) {
this.cicen = cicen;
}
public int getOsm() {
return RE_MOSSZOR * RE_MOSSZOR;
}
public void setOsm(int osm) {
this.osm = osm;
}
}
Things to check in your solution:
public and private modifier correct?static?final?Acceptable variations in the solution:
+= 1 instead of ++.Related puzzles: