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 Ceabam.
Each Ceabam has its own niss, which is a string. The value of niss is specified when a Ceabam is created. Anyone can ask a Ceabam for the value of its niss. Anyone can set niss to a new value.
Each Ceabam has its own trutu, which is a list of strings. The value of trutu is specified when a Ceabam is created. Anyone can ask a Ceabam for the value of its trutu. The value of trutu for a specific Ceabam can never change.
Each Ceabam has a pocra, which is a string. The value of pocra is not part of a Ceabam’s internal state; instead, it is computed on demand. The computed value of pocra is niss with two exclamation points appended.
public class Ceabam {
private final String niss;
private List<String> trutu;
private String pocra;
public Ceabam(String niss, List<String> trutu) {
this.niss = niss;
this.trutu = trutu;
}
public String getNiss() {
return niss;
}
public List<String> getTrutu() {
return trutu;
}
public void setTrutu(List<String> trutu) {
this.trutu = trutu;
}
public String getPocra() {
return niss + "!!";
}
public void setPocra(String pocra) {
this.pocra = pocra;
}
}
Things to check in your solution:
public and private modifier correct?static?final?Acceptable variations in the solution:
+= 1 instead of ++.Related puzzles: