Skip to content

Conversation

@tetyanko
Copy link

@tetyanko tetyanko commented Dec 8, 2016

No description provided.

@didva didva self-assigned this Dec 10, 2016
}

// normalized
private static int normalized (int d1, int d2) {
Copy link
Contributor

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) {
Copy link
Contributor

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);
Copy link
Contributor

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) {
Copy link
Contributor

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(){
Copy link
Contributor

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;
Copy link
Contributor

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.

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