Skip to content

Conversions implemented in Java #433

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

Closed
wants to merge 1 commit into from

Conversation

RishiPrakash
Copy link

I have added 2 files for Roman to Int and Int to Roman conversion.

@RishiPrakash RishiPrakash mentioned this pull request May 2, 2018
Copy link

@christianbender christianbender left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good Work! I have some requests.

@@ -0,0 +1,101 @@
public class IntToRoman {

int value(int toPret){

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please have a look on the code style conventions Between methods and { a space.

intToRoman(a%toRepeat);
return str.toString();

}

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Correct indentation.

for(int i =0;i<(a/toRepeat);i++){
str.append(corString);
}
if((a%toRepeat)>0)

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Between if and (...) one space. See

int intVal = 11128;
System.out.println(new IntToRoman().intToRoman(intVal));

}

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please correct the indentation.

return 0;
}
}
public int romanToInt(String a1) {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please correct indentation.

return total;
}

public static void main(String[] s){

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same thing as above.

@@ -0,0 +1,101 @@
public class IntToRoman {

int value(int toPret){

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This methods you can write as static. Then you don't need the instanciate a object of type IntToRoman and you can use this method right away in you main method.

return "";
}

StringBuffer str = new StringBuffer();

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You don't need StringBuffer you can simply use String.

@RishiPrakash
Copy link
Author

@christianbender Okay Christian I will update my files and will let you know.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants