Skip to content

Add triangular prism surface area calculation - #7695

Draft
JMullin-06 wants to merge 3 commits into
TheAlgorithms:masterfrom
JMullin-06:lab6
Draft

JMullin-06 wants to merge 3 commits into
TheAlgorithms:masterfrom
JMullin-06:lab6

Conversation

@JMullin-06

Copy link
Copy Markdown

Description

Adds a method to calculate the surface area of a triangular prism with a right-triangle base to the Area class.

Changes

  • Added surfaceAreaTriangularPrism() to calculate the total surface area using the two perpendicular sides of the triangular base and the prism length.
  • Added input validation to reject non-positive dimensions.
  • Included JavaDoc documentation for the method and its parameters.
  • Added correct argument exception to 'surfaceAreaPyramid()'

Formula

For perpendicular sides (a) and (b), and prism length (L):

[
SA = ab + L(a+b+\sqrt{a^2+b^2})
]

##Testing

Added a test using sides 3 and 4 and prism length 10, expecting a surface area of 132.0.
Added tests for zero and negative input values.

Checklist

  • Code follows the repository's style guidelines.
  • Unit tests pass.
  • No unrelated changes are included.

@codecov-commenter

codecov-commenter commented Oct 29, 2026 •

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 90.90909% with 1 line in your changes missing coverage. Please review.
✅ Project coverage is 82.22%. Comparing base (2319794) to head (4002d5a).

Files with missing lines Patch % Lines
src/main/java/com/thealgorithms/maths/Area.java 90.90% 1 Missing ⚠️
Additional details and impacted files
@@             Coverage Diff              @@
##             master    #7695      +/-   ##
============================================
- Coverage     82.22%   82.22%   -0.01%     
- Complexity     8403     8405       +2     
============================================
  Files           843      843              
  Lines         26141    26151      +10     
  Branches       5100     5102       +2     
============================================
+ Hits          21495    21503       +8     
  Misses         3854     3854              
- Partials        792      794       +2     

☔ View full report in Codecov by Harness.
📢 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.

@JMullin-06
JMullin-06 marked this pull request as draft October 29, 2026 20:32
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