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 Prepu.
Each Prepu has its own daWano, which is a string. The value of daWano starts out as "hiapi". Anyone can ask a Prepu for the value of its daWano. Anyone can set daWano to a new value.
Each Prepu has its own poc, which is an int. The value of poc is specified when a Prepu is created. Anyone can ask a Prepu for the value of its poc. The value of poc for a specific Prepu can never change.
Each Prepu has a auSpusm, which is an int. The value of auSpusm is not part of a Prepu’s internal state; instead, it is computed on demand. The computed value of auSpusm is poc plus 4.
public class Prepu {
private final String daWano;
private int poc;
private int auSpusm;
public Prepu(int poc) {
this.poc = poc;
}
public String getDaWano() {
return daWano;
}
public int getPoc() {
return poc;
}
public void setPoc(int poc) {
this.poc = poc;
}
public int getAuSpusm() {
return poc + 4;
}
public void setAuSpusm(int auSpusm) {
this.auSpusm = auSpusm;
}
}
Things to check in your solution:
public and private modifier correct?static?final?Acceptable variations in the solution:
+= 1 instead of ++.Related puzzles: