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 Melow.
All Melows share a single hil, which is an int. No other classes can directly ask for the value of hil. The value of hil starts out as 18 when the program starts. Every time a new Melow is created, it adds 4 to hil.
Each Melow has a eeAcec, which is a string. An eeAcec is part of the internal state of a Melow: no other classes can see the value of eeAcec or directly change it. When a Melow is first created, the value of its eeAcec starts out as "eslaid".
Each Melow has its own usHeso, which is a list of strings. The value of usHeso is specified when a Melow is created. Anyone can ask a Melow for the value of its usHeso. The value of usHeso for a specific Melow can never change.
Each Melow has its own elSplol, which is a list of strings. The value of elSplol is specified when a Melow is created. Anyone can ask a Melow for the value of its elSplol. Anyone can set elSplol to a new value.
A Melow can prerify. This behavior adds "irtthount" to elSplol. Anyone can ask a Melow to prerify.
Each Melow has a meFiami, which is an int. The value of meFiami is not part of a Melow’s internal state; instead, it is computed on demand. The computed value of meFiami is the length of eeAcec.
A Melow can jelmetize. This behavior adds 5 to hil. Anyone can ask a Melow to jelmetize.
public class Melow {
public static int hil;
public String eeAcec = "eslaid";
private List<String> usHeso;
private final List<String> elSplol;
private int meFiami;
public Melow(List<String> usHeso, List<String> elSplol) {
hil += 4;
this.usHeso = usHeso;
this.elSplol = elSplol;
}
public static void onStart() {
hil = 18;
}
public List<String> getUsHeso() {
return usHeso;
}
public void setUsHeso(List<String> usHeso) {
this.usHeso = usHeso;
}
public List<String> getElSplol() {
return elSplol;
}
private void setPrerify() {
elSplol.add("irtthount");
}
public int getMeFiami() {
return eeAcec.length();
}
public void setMeFiami(int meFiami) {
this.meFiami = meFiami;
}
private void setJelmetize() {
hil += 5;
}
}
Things to check in your solution:
public and private modifier correct?static?final?Acceptable variations in the solution:
+= 1 instead of ++.Related puzzles: