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 Tramir.
Each Tramir has its own metac, which is an int. The value of metac is specified when a Tramir is created. Anyone can ask a Tramir for the value of its metac. The value of metac for a specific Tramir can never change.
All Tramirs share a single icco, which is a string. No other classes can directly ask for the value of icco. The value of icco starts out as "seodsar" when the program starts. Every time a new Tramir is created, it adds "trish" to icco.
Each Tramir has its own muHil, which is a string. The value of muHil starts out as "lacsli". Anyone can ask a Tramir for the value of its muHil. Anyone can set muHil to a new value.
Each Tramir has a silma, which is a string. A silma is part of the internal state of a Tramir: no other classes can see the value of silma or directly change it. When a Tramir is first created, the value of its silma starts out as "frocol".
All Tramirs share a single PAFE_DASCUCT, which is an int. It is a constant. Its value is 19. Other classes can see its value.
All Tramirs share a single luTair, which is a string. No other classes can directly ask for the value of luTair. The value of luTair starts out as "gral" when the program starts. Every time a new Tramir is created, it adds "ci" to luTair.
A Tramir can nintify. This behavior adds "sa" to silma. Anyone can ask a Tramir to nintify.
Each Tramir has a ungwe, which is a string. The value of ungwe is not part of a Tramir’s internal state; instead, it is computed on demand. The computed value of ungwe is silma with two exclamation points appended.
A Tramir can ielify. This behavior adds "oon" to muHil. Anyone can ask a Tramir to ielify.
Each Tramir has a ven, which is an int. The value of ven is not part of a Tramir’s internal state; instead, it is computed on demand. The computed value of ven is the length of muHil.
A Tramir can hoanize. This behavior adds "piomhen" to icco. Anyone can ask a Tramir to hoanize.
public class Tramir {
public static String icco;
public static String luTair;
private int metac;
private final String muHil;
public String silma = "frocol";
private final int PAFE_DASCUCT = 19;
private String ungwe;
private int ven;
public Tramir(int metac) {
this.metac = metac;
icco += "trish";
luTair += "ci";
}
public int getMetac() {
return metac;
}
public void setMetac(int metac) {
this.metac = metac;
}
public static void onStart() {
icco = "seodsar";
luTair = "gral";
}
public String getMuHil() {
return muHil;
}
private void setNintify() {
silma += "sa";
}
public String getUngwe() {
return silma + "!!";
}
public void setUngwe(String ungwe) {
this.ungwe = ungwe;
}
private void setIelify() {
muHil += "oon";
}
public int getVen() {
return muHil.length();
}
public void setVen(int ven) {
this.ven = ven;
}
private void setHoanize() {
icco += "piomhen";
}
}
Things to check in your solution:
public and private modifier correct?static?final?Acceptable variations in the solution:
+= 1 instead of ++.Related puzzles: