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 an Ossou.
Each Ossou has a veMuc, which is a list of strings. A veMuc is part of the internal state of an Ossou: no other classes can see the value of veMuc or directly change it. When an Ossou is first created, the value of its veMuc starts out as an empty mutable list.
Each Ossou has its own dused, which is a list of strings. The value of dused starts out as an empty mutable list. Anyone can ask an Ossou for the value of its dused. Anyone can set dused to a new value.
All Ossous share a single pivi, which is an int. No other classes can directly ask for the value of pivi. The value of pivi starts out as 11 when the program starts. Every time a new Ossou is created, it adds 4 to pivi.
An Ossou can wonorate. This behavior adds 6 to pivi. Anyone can ask an Ossou to wonorate.
Each Ossou has a eniss, which is a string. The value of eniss is not part of an Ossou’s internal state; instead, it is computed on demand. The computed value of eniss is the first element of dused.
public class Ossou {
public static int pivi;
public List<String> veMuc = new ArrayList<>();
private final List<String> dused;
private String eniss;
public Ossou() {
pivi += 4;
}
public List<String> getDused() {
return dused;
}
public static void onStart() {
pivi = 11;
}
private void setWonorate() {
pivi += 6;
}
public String getEniss() {
return dused.get(0);
}
public void setEniss(String eniss) {
this.eniss = eniss;
}
}
Things to check in your solution:
public and private modifier correct?static?final?Acceptable variations in the solution:
+= 1 instead of ++.Related puzzles: