This project is a Currency Conversion System implemented in Java, showcasing the concept of Polymorphism. It is designed to calculate the equivalent amount in Sri Lankan Rupees (LKR) for various currencies such as USD, GBP, and EUR. Here there are two Java codes, one using user inputs and converting one and another, attaching the inputs to the code and displaying it.
The program demonstrates Object-Oriented Programming (OOP) principles, including:
- Inheritance
- Polymorphism
- Encapsulation
- Dynamic Currency Conversion: Convert USD, GBP, or EUR to LKR.
- Scalable Design: Easily extendable to support additional currencies.
- Clear Modular Structure: Separate classes for each currency.
The following conversion rates are used:
- 1 USD = 290 LKR
- 1 GBP = 370 LKR
- 1 EUR = 307 LKR
CurrencyConverter.java- Base class with the genericconvertmethod.USDConverter.java- Subclass for USD to LKR conversion.GBPConverter.java- Subclass for GBP to LKR conversion.EURConverter.java- Subclass for EUR to LKR conversion.CurrencyConversionApp.java- Main class for user input and execution.
- Input:
Enter the currency type (USD/GBP/EUR): USD Enter the amount to convert: 100 2. Output:
Converted amount in LKR: 36000.0
-
Clone the repository: git clone https://github.com/medini2006/currency-conversion-system.git
-
Compile the files: javac *.java
-
Run the program. java CurrencyConversionApp.
- Java
- Object-Oriented Programming
- Add support for additional currencies.
- Implement real-time conversion rates using an API.
- Develop a graphical user interface (GUI) for user interaction.
Created by Medini Thrishala Thudahewage. Feel free to reach out for collaboration or feedback!