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

Remove multiply and divide methods accepting double from ComplexNumber #2851

Closed

Conversation

jagdish-15
Copy link
Contributor

@jagdish-15 jagdish-15 commented Nov 2, 2024

pull request

Description

This pull request removes the multiply and divide methods that accept a double parameter from the ComplexNumber class in both the reference solution and the main.java file. These methods were deemed unnecessary since the primary focus of the exercise is to operate on complex numbers, and the existing tests do not validate these double overloads.

Changes Made:

  • Removed multiply(double factor) and divide(double divisor) methods from the ComplexNumber class.
  • Updated the reference solution accordingly to ensure consistency.

Rationale

The double overloads for multiplication and division were not accompanied by corresponding test cases in the canonical data, which could lead to situations where these methods are not adequately tested. By removing these methods, we streamline the class and enhance clarity, ensuring that the exercise focuses on complex number operations as intended.

Next Steps

Please review the changes and let me know if further modifications are needed.

Reviewer Resources:

Track Policies

@jagdish-15 jagdish-15 closed this Nov 2, 2024
Copy link
Member

@kahgoh kahgoh left a comment

Choose a reason for hiding this comment

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

Thanks for submitting the PR! I think the change in principle looks good. There's just the compile error from the lint output to fix.

}

private ComplexNumber multiply(double factor) {
return new ComplexNumber(factor * real, factor * imaginary);
Copy link
Member

Choose a reason for hiding this comment

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

There is a compile error because this method is still being used on line 49 (see the Lint output).

@kahgoh kahgoh reopened this Nov 2, 2024
@jagdish-15 jagdish-15 closed this by deleting the head repository Nov 2, 2024
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