Skip to content

Conversation

@gimenezr
Copy link
Collaborator

No description provided.

Copy link
Owner

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.");
}

@gimenezr
Copy link
Collaborator Author

Subí el ejercicio con las mejoras que mencionaste.

Copy link
Owner

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?

@justomiguel
Copy link
Owner

Cuando puedas pegale un vistazo a esto

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants