Skip to content
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

Open
wants to merge 4 commits into
base: bootcamp_roberta
Choose a base branch
from
Open

Conversation

gimenezr
Copy link
Collaborator

No description provided.

case 'I':
return I.value;
case 'V':
return V.value;
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.

return " There isn't zero in Roman number System";
}
StringBuilder resul = new StringBuilder();
while (dec >= 1000) {
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