Skip to content

Add Volume "Algorithm Frustum Of Cone" Then Test It. #5479

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

Merged
merged 4 commits into from
Sep 30, 2024

Conversation

ahmedelazab1220
Copy link
Contributor

@ahmedelazab1220 ahmedelazab1220 commented Sep 29, 2024

Hey I've implemented FrustumOfCone Algorithm in src/main/java/com.thealgorithms/maths/Volume.java
with the test class in the test package

for enhancement #5478

Algorithm Overview:

  1. Input Parameters: The method accepts three parameters:

    • r1: radius of the top circular base
    • r2: radius of the bottom circular base
    • height: height of the frustum
  2. Volume Calculation: The method calculates the volume using the defined formula and returns the computed value as a double.

  3. Unit Testing: Comprehensive unit tests have been implemented to validate the correctness of the calculation. The tests cover various scenarios to ensure that the function behaves as expected.

Performance:

  • The time complexity of the volume calculation is O(1), as it involves a fixed number of arithmetic operations.

  • This method provides an efficient way to compute the volume for practical applications, making it suitable for real-time calculations in engineering and design software.

  • 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

@codecov-commenter
Copy link

codecov-commenter commented Sep 29, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 52.29%. Comparing base (1e8abf1) to head (3834126).
Report is 212 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff            @@
##             master    #5479   +/-   ##
=========================================
  Coverage     52.29%   52.29%           
- Complexity     3256     3257    +1     
=========================================
  Files           525      525           
  Lines         15184    15185    +1     
  Branches       2887     2887           
=========================================
+ Hits           7940     7941    +1     
  Misses         6920     6920           
  Partials        324      324           

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

@ahmedelazab1220 ahmedelazab1220 changed the title Add Function volumeFrustumOfCone To Calculate Frus tum Of Cone Then Test It. Add Volume "Algorithm Frustum Of Cone" To Calculate Frustum Of Cone Then Test It. Sep 30, 2024
@ahmedelazab1220 ahmedelazab1220 changed the title Add Volume "Algorithm Frustum Of Cone" To Calculate Frustum Of Cone Then Test It. Add Volume "Algorithm Frustum Of Cone" Then Test It. Sep 30, 2024
Anurag127001 pushed a commit to Anurag127001/Java that referenced this pull request Sep 30, 2024
Copy link
Member

@BamaCharanChhandogi BamaCharanChhandogi left a comment

Choose a reason for hiding this comment

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

Looks good, thanks.

@BamaCharanChhandogi BamaCharanChhandogi merged commit 7c56a73 into TheAlgorithms:master Sep 30, 2024
6 checks passed
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.

3 participants