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

I have Updated Maths/AverageUpdation #5415

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions src/main/java/com/thealgorithms/maths/Average.java
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
* This class provides static methods to calculate the average of arrays
* of both {@code double} and {@code int} values.
*/

public final class Average {

// Prevent instantiation of this utility class
Expand All @@ -21,7 +22,7 @@ private Average() {
*/
public static double average(double[] numbers) {
if (numbers == null || numbers.length == 0) {
throw new IllegalArgumentException("Numbers array cannot be empty or null");
throw new IllegalArgumentException("Numbers array are cannot be empty or null");
Copy link
Contributor

Choose a reason for hiding this comment

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

Looks like before changes it was correct. And now "are" is unnecessary.

}
double sum = 0;
for (double number : numbers) {
Expand All @@ -39,7 +40,7 @@ public static double average(double[] numbers) {
*/
public static double average(int[] numbers) {
if (numbers == null || numbers.length == 0) {
throw new IllegalArgumentException("Numbers array cannot be empty or null");
throw new IllegalArgumentException("Numbers array are cannot be empty or null");
}
long sum = 0;
for (int number : numbers) {
Expand Down