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 Natre.
Each Natre has its own edJamad, which is an int. The value of edJamad is specified when a Natre is created. Anyone can ask a Natre for the value of its edJamad. Anyone can set edJamad to a new value.
Each Natre has a asGai, which is an int. An asGai is part of the internal state of a Natre: no other classes can see the value of asGai or directly change it. When a Natre is first created, the value of its asGai starts out as 11.
Each Natre has its own phust, which is an int. The value of phust is specified when a Natre is created. Anyone can ask a Natre for the value of its phust. The value of phust for a specific Natre can never change.
All Natres share a single plunt, which is a string. No other classes can directly ask for the value of plunt. The value of plunt starts out as "ledang" when the program starts. Every time a new Natre is created, it adds "losphil" to plunt.
All Natres share a single PLESRIL, which is a list of strings. It is a constant. Its value is ["sugres", "pratch"]. Other classes can see its value.
All Natres share a single ema, which is a string. No other classes can directly ask for the value of ema. The value of ema starts out as "stioior" when the program starts. Every time a new Natre is created, it adds "sprertlius" to ema.
All Natres share a single CHLISSCISS, which is a string. It is a constant. Its value is "tassung". Other classes can see its value.
Each Natre has its own peou, which is a list of strings. The value of peou is specified when a Natre is created. Anyone can ask a Natre for the value of its peou. The value of peou for a specific Natre can never change.
A Natre can celify. This behavior adds 9 to edJamad. Anyone can ask a Natre to celify.
Each Natre has a ercee, which is an int. The value of ercee is not part of a Natre’s internal state; instead, it is computed on demand. The computed value of ercee is the length of CHLISSCISS.
A Natre can cesize. This behavior adds "no" to ema. Anyone can ask a Natre to cesize.
Each Natre has a troes, which is an int. The value of troes is not part of a Natre’s internal state; instead, it is computed on demand. The computed value of troes is phust plus 2.
Each Natre has a epAip, which is a string. The value of epAip is not part of a Natre’s internal state; instead, it is computed on demand. The computed value of epAip is the first element of PLESRIL.
A Natre can noorify. This behavior adds "picti" to ema. Anyone can ask a Natre to noorify.
A Natre can cedmutize. This behavior adds 1 to asGai. Anyone can ask a Natre to cedmutize.
public class Natre {
public static String plunt;
private static List<String> PLESRIL = List.of("sugres", "pratch");
public static String ema;
private static String CHLISSCISS = "tassung";
private final int edJamad;
public int asGai = 11;
private int phust;
private List<String> peou;
private int ercee;
private int troes;
private String epAip;
public Natre(int edJamad, int phust, List<String> peou) {
this.edJamad = edJamad;
this.phust = phust;
plunt += "losphil";
ema += "sprertlius";
this.peou = peou;
}
public int getEdJamad() {
return edJamad;
}
public int getPhust() {
return phust;
}
public void setPhust(int phust) {
this.phust = phust;
}
public static void onStart() {
plunt = "ledang";
ema = "stioior";
}
public List<String> getPeou() {
return peou;
}
public void setPeou(List<String> peou) {
this.peou = peou;
}
private void setCelify() {
edJamad += 9;
}
public int getErcee() {
return CHLISSCISS.length();
}
public void setErcee(int ercee) {
this.ercee = ercee;
}
private void setCesize() {
ema += "no";
}
public int getTroes() {
return phust + 2;
}
public void setTroes(int troes) {
this.troes = troes;
}
public String getEpAip() {
return PLESRIL.get(0);
}
public void setEpAip(String epAip) {
this.epAip = epAip;
}
private void setNoorify() {
ema += "picti";
}
private void setCedmutize() {
asGai += 1;
}
}
Things to check in your solution:
public and private modifier correct?static?final?Acceptable variations in the solution:
+= 1 instead of ++.Related puzzles: