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

[New Feature] Numbers to Word Representations Converter #6136

Conversation

ZingadePrathamesh
Copy link
Contributor

  • 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

Features

  • Whole Number Conversion: Supports numbers from 0 to trillions.
  • Decimal Support: Accurately converts fractional parts of numbers (e.g., 123.45 becomes One Hundred Twenty-Three Point Four Five).
  • Readable Code: Written with clean and modular methods for easy understanding and extension.
  • Customizable: Can be easily modified to support additional languages or features.

Example Usage

Here’s how you can use the NumberToWordsConverter class in your Java application:

import java.math.BigDecimal;

public class Main {

     public static void main(String[] args) {
        BigDecimal testValue = new BigDecimal("145.350");
        System.out.println("In Words: " + NumberToWordsConverter.convert(testValue));

        BigDecimal testValue2 = new BigDecimal("-010000010.01056");
        System.out.println("In Words: " + NumberToWordsConverter.convert(testValue2));
    }
}

@codecov-commenter
Copy link

Codecov Report

Attention: Patch coverage is 95.12195% with 2 lines in your changes missing coverage. Please review.

Project coverage is 73.80%. Comparing base (754bf6c) to head (ed99d9c).

Files with missing lines Patch % Lines
...a/com/thealgorithms/conversions/NumberToWords.java 95.12% 0 Missing and 2 partials ⚠️
Additional details and impacted files
@@             Coverage Diff              @@
##             master    #6136      +/-   ##
============================================
+ Coverage     73.75%   73.80%   +0.05%     
- Complexity     5126     5144      +18     
============================================
  Files           659      660       +1     
  Lines         17628    17669      +41     
  Branches       3392     3404      +12     
============================================
+ Hits          13001    13041      +40     
  Misses         4120     4120              
- Partials        507      508       +1     

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

@ZingadePrathamesh ZingadePrathamesh deleted the prathamesh-zingage branch January 14, 2025 06:11
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