Skip to content

Conversation

@MarkusRoyikTurner
Copy link

@MarkusRoyikTurner MarkusRoyikTurner commented Oct 22, 2025

  • I have read CONTRIBUTING.md.
  • This pull request is all my own work -- I have not plagiarized it.
  • All filenames are in PascalCase.
  • All functions and variable names follow Java naming conventions.
  • All new algorithms have a URL in their comments that points to Wikipedia or other similar explanations.
  • All new code is formatted with clang-format -i --style=file path/to/your/file.java

@MarkusRoyikTurner
Copy link
Author

This update introduces a new method named surfaceAreaPyramid to the Area.java class. The method calculates the total surface area of a pyramid with a square base by combining the base area and the lateral triangular faces. It includes clear inline comments and follows proper Java naming and formatting conventions.

The code validates both input parameters to ensure positive values, using IllegalArgumentException for invalid inputs. Documentation is provided in Javadoc format, describing the parameters, return value, and potential exceptions.

This commit was created as part of ENGG*4450 Lab 6 to demonstrate the Git branching, committing, and pull request workflow. The work was completed individually and verified to compile successfully. The feature branch feature/surfaceAreaPyramid_v4 was pushed to GitHub and opened as a pull request for review and potential merge into the main branch.

@codecov-commenter
Copy link

codecov-commenter commented Oct 22, 2025

Codecov Report

❌ Patch coverage is 0% with 7 lines in your changes missing coverage. Please review.
✅ Project coverage is 77.96%. Comparing base (8930369) to head (0b2841e).

Files with missing lines Patch % Lines
src/main/java/com/thealgorithms/maths/Area.java 0.00% 7 Missing ⚠️
Additional details and impacted files
@@             Coverage Diff              @@
##             master    #6896      +/-   ##
============================================
- Coverage     78.00%   77.96%   -0.04%     
  Complexity     6444     6444              
============================================
  Files           737      737              
  Lines         21519    21526       +7     
  Branches       4208     4209       +1     
============================================
- Hits          16785    16783       -2     
- Misses         4062     4070       +8     
- Partials        672      673       +1     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Copy link
Author

@MarkusRoyikTurner MarkusRoyikTurner left a comment

Choose a reason for hiding this comment

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

The new method is correctly implemented and aligns with existing project style guidelines.
All formulas and variable names are accurate and consistent. Validation logic prevents invalid inputs,
and inline comments improve clarity for future developers.

In GitHub, the Files changed tab was used to add these line comments individually.
The pull request was then reviewed using the Review changes -> Comment option to provide
overall feedback confirming that the implementation was correct and ready for merge.

}

// Base area (square) = side²
double baseArea = sideLength * sideLength;
Copy link
Author

Choose a reason for hiding this comment

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

Simple and efficient calculation of the square base area.
Variable naming (baseArea) is clear and self-explanatory.

double baseArea = sideLength * sideLength;

// Lateral area = 2 × side × slant height
double lateralSurfaceArea = 2 * sideLength * slantHeight;
Copy link
Author

Choose a reason for hiding this comment

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

Accurate computation for the combined area of four triangular sides.
The inline comment clarifies why the factor of 2 is used instead of 4 × ½ × base × height.

return Math.PI * radius * (radius + Math.pow(height * height + radius * radius, 0.5));
}
/**
/**
Copy link
Author

Choose a reason for hiding this comment

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

fix the spacing issue in the code

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