Welcome to the Professional Multi-Currency Converter – a Java application that fetches real-time exchange rates from the European Central Bank via the Frankfurter API! This project is perfect for beginners looking to understand API integration, exception handling, and clean Java architecture.
- Real-time Exchange Rates – Live data from European Central Bank
- Multi-Currency Support – Includes both major and emerging currencies
- Robust Error Handling – Custom exceptions for API failures
- Clean Architecture – Separated service layer and business logic
- User-Friendly CLI – Simple command-line interface
- Professional Standards – Proper User-Agent headers and input validation
- Java 11 or higher (for
HttpClientsupport) - Internet connection (for API calls)
- Basic Java knowledge (perfect for learning!)
-
Clone the repository
git clone https://github.com/daniel-oyoo/currency-converter.git cd currency-converter -
Compile the Java file
javac CurrencyApp.java
-
Run the application
java CurrencyApp
- Launch the application
- View available currencies (majors & minors)
- Enter a 3-letter currency code (e.g., EUR, JPY, INR)
- Enter the amount in USD
- View the converted amount with live rates!
Example session:
=== PROFESSIONAL MULTI-CURRENCY CONVERTER ===
Available Majors: [EUR, GBP, JPY, CAD, AUD]
Available Minors: [INR, BRL, ZAR, TRY, THB]
Enter Target Currency Code: EUR
Enter Amount in USD: 100
Fetching live rate for EUR...
====================
Result: 100.00 USD = 92.50 EUR
Exchange Rate: 1 USD = 0.9250 EUR
====================
CurrencyApp.java
- Uses Java 11+ HttpClient
- Fetches from Frankfurter API (free, no API key needed)
- Implements proper User-Agent headers
- Includes HTTP status code validation
ApiException– Custom exception for API/network errorsCurrencyService– Handles all API communicationsCurrencyApp– Main class with user interface- Input Validation – Prevents invalid currency codes
We welcome all contributors – especially beginners! Here's how you can help:
- Add more currency codes
- Improve error messages
- Create a GUI version
- Add historical rate tracking
- Implement unit tests
- Fork this repository
- Create a branch (
git checkout -b feature/AmazingFeature) - Commit changes (
git commit -m 'Add some AmazingFeature') - Push to branch (
git push origin feature/AmazingFeature) - Open a Pull Request
- Follow Java naming conventions
- Add comments for new complex logic
- Test your changes before submitting
- Update documentation if needed
- HttpClient – Java's modern HTTP client
- JSON Parsing – Manual parsing technique
- Exception Handling – Custom exceptions
- API Integration – RESTful service consumption
| Issue | Solution |
|---|---|
| "API Error: Received status code 429" | You're being rate-limited. Wait a minute and try again. |
| "Input Error: Please enter numbers only" | Enter numeric values for amounts (e.g., 100, 50.25) |
| "Currency not supported" | Use only the currencies listed in the available sets |
| Compilation errors | Ensure you're using Java 11+ |
This project is licensed under the MIT License - see the LICENSE file for details.
- Frankfurter API for providing free exchange rate data
- European Central Bank for the source data
- All contributors who help improve this project
- Create an issue for bugs or feature requests
- Start a discussion for questions
- Check existing issues before creating new ones
If you find this project helpful, please give it a star!
Happy Coding!
Built with love for the Java learning community