Skip to content

A simple console application that converts currencies based on live exchange rates

License

Notifications You must be signed in to change notification settings

ShaharAshe/ExchangeRateConverter

Repository files navigation


🌎 Exchange Rate Converter

MIT License

An application that converts currency from one country to another based on real-time exchange rates fetched from the 🌐 ExchangeRate-API.

📋 Table of Contents

🔍 Overview

The Exchange Rate Converter is a console application that reads currency details from a file and performs currency conversion calculations using live exchange rates.

✨ Features

  • 📄 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.

📁 Project Structure

  • 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.

🚀 Getting Started

Prerequisites

Installation

  1. Clone the repository:

    git clone https://github.com/your-username/exchange-rate-converter.git
    cd exchange-rate-converter
  2. Restore dependencies (if applicable):

    dotnet restore

⚙️ Configuration

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"
  }
}

🛠 Usage

Run the Application

Run the following command in your terminal, specifying the file with currency details:

dotnet run -- "path/to/your/input_file.txt"

📄 Input File Format

The input file should have the following format:

  1. Line 1: Country code of the currency to convert from (e.g., USD)
  2. Line 2: Country code of the currency to convert to (e.g., EUR)
  3. Remaining lines: Values to be converted

Example:

USD
EUR
100
250
50

Example

For the input file above, the program outputs the equivalent EUR values for each USD amount based on current rates.

💻 Technologies Used

  • C#
  • .NET 4.7.2
  • ExchangeRate-API
  • Newtonsoft.Json for JSON parsing

📄 License

This project is licensed under the MIT License - see the LICENSE file for details.

Contact