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 Sende.
Each Sende has its own ridci, which is a list of strings. The value of ridci is specified when a Sende is created. Anyone can ask a Sende for the value of its ridci. The value of ridci for a specific Sende can never change.
All Sendes share a single FICK_SPRA, which is a string. It is a constant. Its value is "nal". Other classes cannot see its value.
Each Sende has a ruo, which is a string. A ruo is part of the internal state of a Sende: no other classes can see the value of ruo or directly change it. When a Sende is first created, the value of its ruo starts out as "u".
All Sendes share a single celun, which is a list of strings. No other classes can directly ask for the value of celun. The value of celun starts out as an empty mutable list when the program starts. Every time a new Sende is created, it adds "arpiw" to celun.
Each Sende has its own cosor, which is an int. The value of cosor starts out as 18. Anyone can ask a Sende for the value of its cosor. Anyone can set cosor to a new value.
All Sendes share a single mai, which is an int. No other classes can directly ask for the value of mai. The value of mai starts out as 12 when the program starts. Every time a new Sende is created, it adds 3 to mai.
A Sende can pecify. This behavior adds "o" to ruo. Anyone can ask a Sende to pecify.
Each Sende has a reSne, which is an int. The value of reSne is not part of a Sende’s internal state; instead, it is computed on demand. The computed value of reSne is the size of ridci.
A Sende can vedilate. This behavior adds "brardin" to ruo. Anyone can ask a Sende to vedilate.
Each Sende has a los, which is an int. The value of los is not part of a Sende’s internal state; instead, it is computed on demand. The computed value of los is mai plus 1.
A Sende can crenize. This behavior adds 2 to cosor. Anyone can ask a Sende to crenize.
public class Sende {
public static String FICK_SPRA = "nal";
public static List<String> celun;
public static int mai;
private List<String> ridci;
public String ruo = "u";
private final int cosor;
private int reSne;
private int los;
public Sende(List<String> ridci) {
this.ridci = ridci;
celun.add("arpiw");
mai += 3;
}
public List<String> getRidci() {
return ridci;
}
public void setRidci(List<String> ridci) {
this.ridci = ridci;
}
public static void onStart() {
celun = new ArrayList<>();
mai = 12;
}
public int getCosor() {
return cosor;
}
private void setPecify() {
ruo += "o";
}
public int getReSne() {
return ridci.size();
}
public void setReSne(int reSne) {
this.reSne = reSne;
}
private void setVedilate() {
ruo += "brardin";
}
public int getLos() {
return mai + 1;
}
public void setLos(int los) {
this.los = los;
}
private void setCrenize() {
cosor += 2;
}
}
Things to check in your solution:
public and private modifier correct?static?final?Acceptable variations in the solution:
+= 1 instead of ++.Related puzzles: