-
Notifications
You must be signed in to change notification settings - Fork 20k
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
Conversation
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.
Good Work! I have some requests.
@@ -0,0 +1,101 @@ | |||
public class IntToRoman { | |||
|
|||
int value(int toPret){ |
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.
Please have a look on the code style conventions Between methods and {
a space.
intToRoman(a%toRepeat); | ||
return str.toString(); | ||
|
||
} |
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.
Correct indentation.
for(int i =0;i<(a/toRepeat);i++){ | ||
str.append(corString); | ||
} | ||
if((a%toRepeat)>0) |
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.
Between if
and (...)
one space. See
int intVal = 11128; | ||
System.out.println(new IntToRoman().intToRoman(intVal)); | ||
|
||
} |
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.
Please correct the indentation.
return 0; | ||
} | ||
} | ||
public int romanToInt(String a1) { |
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.
Please correct indentation.
return total; | ||
} | ||
|
||
public static void main(String[] s){ |
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.
Same thing as above.
@@ -0,0 +1,101 @@ | |||
public class IntToRoman { | |||
|
|||
int value(int toPret){ |
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.
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(); |
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.
You don't need StringBuffer
you can simply use String
.
@christianbender Okay Christian I will update my files and will let you know. |
I have added 2 files for Roman to Int and Int to Roman conversion.