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 Vorfguc.
All Vorfgucs share a single arrul, which is a string. No other classes can directly ask for the value of arrul. The value of arrul starts out as "wossgass" when the program starts. Every time a new Vorfguc is created, it adds "ed" to arrul.
Each Vorfguc has its own caBa, which is a string. The value of caBa is specified when a Vorfguc is created. Anyone can ask a Vorfguc for the value of its caBa. The value of caBa for a specific Vorfguc can never change.
Each Vorfguc has its own clioc, which is a list of strings. The value of clioc is specified when a Vorfguc is created. Anyone can ask a Vorfguc for the value of its clioc. Anyone can set clioc to a new value.
A Vorfguc can pecate. This behavior adds "pi" to arrul. Anyone can ask a Vorfguc to pecate.
Each Vorfguc has a cer, which is a string. The value of cer is not part of a Vorfguc’s internal state; instead, it is computed on demand. The computed value of cer is caBa with two exclamation points appended.
public class Vorfguc {
public static String arrul;
private String caBa;
private final List<String> clioc;
private String cer;
public Vorfguc(String caBa, List<String> clioc) {
arrul += "ed";
this.caBa = caBa;
this.clioc = clioc;
}
public static void onStart() {
arrul = "wossgass";
}
public String getCaBa() {
return caBa;
}
public void setCaBa(String caBa) {
this.caBa = caBa;
}
public List<String> getClioc() {
return clioc;
}
private void setPecate() {
arrul += "pi";
}
public String getCer() {
return caBa + "!!";
}
public void setCer(String cer) {
this.cer = cer;
}
}
Things to check in your solution:
public and private modifier correct?static?final?Acceptable variations in the solution:
+= 1 instead of ++.Related puzzles: