A web application that converts numerical currency values into their written word representation.
- Converts numbers to words in currency format
- Supports values from -999,999,999.99 to 999,999,999.99
- Clean, responsive web interface
- RESTful API endpoint
- Real-time conversion with error handling
Input: 123.45
Output: ONE HUNDRED AND TWENTY-THREE DOLLARS AND FORTY-FIVE CENTS
- .NET 8.0 SDK or higher
- A modern web browser (Chrome, Firefox, Safari, or Edge)
git clone https://github.com/NathanPerrier/NumberToWords.git
cd NumberToWordscd code
dotnet restore
dotnet builddotnet run --launch-profile httpThe application will start and be available at:
- Web Interface: http://localhost:5122
- Swagger API Documentation: http://localhost:5122/swagger
- Open http://localhost:5122 in your browser
- Enter a number (e.g., 123.45)
- Click "Convert to Words" or press Enter
- View the result
curl -X POST "http://localhost:5122/api/conversion/convert" \
-H "Content-Type: application/json" \
-d '{"value": "123.45"}'NumberToWords/
├── code/ # Main application code
│ ├── Controllers/ # API controllers
│ ├── Services/ # Business logic services
│ ├── wwwroot/ # Static web files
│ │ ├── index.html # Main web interface
│ │ ├── css/ # Stylesheets
│ │ └── js/ # JavaScript files
│ ├── Program.cs # Application entry point
│ └── NumbersToWords.csproj # Project configuration
├── DESIGN_APPROACH.md # Design decisions document
├── TEST_PLAN.md # Testing strategy document
└── README.md # This file
Endpoint: POST /api/conversion/convert
Request Body:
{
"value": "123.45"
}Success Response:
{
"success": true,
"words": "ONE HUNDRED AND TWENTY-THREE DOLLARS AND FORTY-FIVE CENTS",
"originalValue": "123.45"
}Error Response:
{
"success": false,
"error": "Invalid format. Please enter a valid number (e.g., 123.45)"
}Endpoint: GET /api/conversion/health
Response:
{
"status": "healthy",
"timestamp": "2024-01-20T10:30:00Z"
}- Numbers must be between -999,999,999.99 and 999,999,999.99
- Maximum of 2 decimal places
- Valid formats:
123,123.45,-123.45 - Invalid formats:
abc,12.345,1,000
dotnet run --launch-profile httpsAccess at: https://localhost:7124
Currently, manual testing is performed using the TEST_PLAN.md document. Unit tests can be added by creating a test project:
dotnet new xunit -n NumbersToWords.Tests
dotnet sln code/NumbersToWords.sln add NumbersToWords.Tests/NumbersToWords.Tests.csproj- Chrome (latest)
- Firefox (latest)
- Safari (latest)
- Edge (latest)
- Mobile browsers (iOS Safari, Chrome Android)
If you see an error about port 5122 being in use:
- Change the port in
code/Properties/launchSettings.json - Or find and stop the process using the port
Ensure you have .NET 8.0 SDK installed:
dotnet --version- Check that the application is running
- Verify the correct URL and port
- Check browser console for JavaScript errors
