An application that converts currency from one country to another based on real-time exchange rates fetched from the 🌐 ExchangeRate-API.
- 🔍 Overview
- ✨ Features
- 📁 Project Structure
- 🚀 Getting Started
- ⚙️ Configuration
- 🛠 Usage
- 💻 Technologies Used
- 📄 License
The Exchange Rate Converter is a console application that reads currency details from a file and performs currency conversion calculations using live exchange rates.
- 📄 Reads input data from a text file.
- 🔗 Retrieves exchange rates via API for specified currencies.
- 💸 Converts values based on the latest exchange rates.
- 🖨 Prints the calculated results to the console.
- Program.cs - The entry point of the application.
- Utilities.cs - A singleton class for configuration constants.
- ReadFile.cs - Reads and processes input file data.
- ExchangeData.cs - Retrieves exchange rate data from an external API.
- ExchangeCalculate.cs - Performs the currency conversion calculations.
- Controller.cs - Orchestrates file reading, exchange rate retrieval, and conversion processes.
- .NET SDK (version 4.7.2 or higher)
- ExchangeRate-API Key 🔑 (to fetch exchange rates)
-
Clone the repository:
git clone https://github.com/your-username/exchange-rate-converter.git cd exchange-rate-converter
-
Restore dependencies (if applicable):
dotnet restore
In the project’s root directory, create a appsettings.json
file with the following structure to store your API key:
{
"AppSettings": {
"API_KEY": "your_api_key_here"
}
}
Run the following command in your terminal, specifying the file with currency details:
dotnet run -- "path/to/your/input_file.txt"
The input file should have the following format:
- Line 1: Country code of the currency to convert from (e.g., USD)
- Line 2: Country code of the currency to convert to (e.g., EUR)
- Remaining lines: Values to be converted
Example:
USD
EUR
100
250
50
For the input file above, the program outputs the equivalent EUR values for each USD amount based on current rates.
- C#
- .NET 4.7.2
- ExchangeRate-API
- Newtonsoft.Json for JSON parsing
This project is licensed under the MIT License - see the LICENSE file for details.
- GitHub: ShaharAshe
- LinkedIn: Shahar Asher
- Email: shaharas30@gmail.com