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 Giascra.
All Giascras share a single DURIA_SLE, which is a list of strings. It is a constant. Its value is ["ib", "ri", "hassa"]. Other classes can see its value.
Each Giascra has its own prass, which is a list of strings. The value of prass is specified when a Giascra is created. Anyone can ask a Giascra for the value of its prass. The value of prass for a specific Giascra can never change.
Each Giascra has a erKe, which is an int. The value of erKe is not part of a Giascra’s internal state; instead, it is computed on demand. The computed value of erKe is the size of DURIA_SLE.
public class Giascra {
private static List<String> DURIA_SLE = List.of("ib", "ri", "hassa");
private List<String> prass;
private int erKe;
public Giascra(List<String> prass) {
this.prass = prass;
}
public List<String> getPrass() {
return prass;
}
public void setPrass(List<String> prass) {
this.prass = prass;
}
public int getErKe() {
return DURIA_SLE.size();
}
public void setErKe(int erKe) {
this.erKe = erKe;
}
}
Things to check in your solution:
public and private modifier correct?static?final?Acceptable variations in the solution:
+= 1 instead of ++.Related puzzles: