-
Notifications
You must be signed in to change notification settings - Fork 169
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Exercise3.4 #49
base: bootcamp_roberta
Are you sure you want to change the base?
Exercise3.4 #49
Conversation
case 'I': | ||
return I.value; | ||
case 'V': | ||
return V.value; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
en ves de tener un switch se podria tener un bucle while que vaya comprando e iterando y corte cuando encuentra el elemento. Existe un metodo que se llama enumClass.values()
public static RomanNumber getRomanValueFromChar(Char i) {
for (RomanNumber romanNumber : RomanNumber.values()) {
if (romanNumber.getValue().equals(i)) {
return romanNumber;
}
}
// throw an IllegalArgumentException or return null
throw new IllegalArgumentException("the given letter doesn't match any Roman Number.");
}
Subí el ejercicio con las mejoras que mencionaste. |
return " There isn't zero in Roman number System"; | ||
} | ||
StringBuilder resul = new StringBuilder(); | ||
while (dec >= 1000) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
En vez de hacer esto no podemos hacer una division? Por ejemplo si yo divido por 1000 el cociente entero me dice cuantas veces deberia poner determinada letra que me decis?
Cuando puedas pegale un vistazo a esto |
No description provided.