-
Notifications
You must be signed in to change notification settings - Fork 8
Task 1... #3
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
base: master
Are you sure you want to change the base?
Task 1... #3
Conversation
| } | ||
|
|
||
| // normalized | ||
| private static int normalized (int d1, int d2) { |
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.
Do you use this method?
|
|
||
|
|
||
|
|
||
| public static void main(String[] args) { |
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 move main method to some other class.
| return (a*d) + "/" + (b*c); | ||
| } | ||
|
|
||
| public static final FractionNumber zero = new FractionNumber (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.
Please rename constants to upper case.
| return (a*c) + "/" + (b*d); | ||
| } | ||
|
|
||
| public String divFraction(FractionNumber otherFraction) { |
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.
All these math methods should return FractionNumber
| private int d2; //divisor | ||
|
|
||
| //no arguments constructor | ||
| public FractionNumber(){ |
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.
No need in this constructor.
| //constructor d1 and d2 | ||
| public FractionNumber(int d1, int d2) { | ||
| if(d2 == 0) throw new IllegalArgumentException("Divisor is zero"); | ||
| this.d1 = d1; |
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 add normalization on object creation.
No description provided.