A Java-based console application that converts amounts between different currencies using predefined exchange rates. This program supports conversions among six major currencies, simplifying the conversion process by using INR as an intermediary.
- Convert between any two of the supported currencies: USD, EUR, GBP, CAD, AUD, and INR.
- Predefined exchange rates: The rates are hardcoded for simplicity.
- Console-based interaction: Easy-to-use console prompts guide the user through the currency conversion process.
- USD - United States Dollar
- EUR - Euro
- GBP - British Pound
- CAD - Canadian Dollar
- AUD - Australian Dollar
- INR - Indian Rupee
The exchange rates are based on the following conversions to INR (Indian Rupee):
- USD to INR: 84.10
- EUR to INR: 90.82
- GBP to INR: 109.02
- CAD to INR: 60.52
- AUD to INR: 55.63
- Java Development Kit (JDK) installed on your system
- A Java-compatible IDE or a text editor with console support
- Follow the prompts to select the source and target currencies.
- Enter the amount to convert.
- The program will display the converted amount.
To convert 100 GBP to CAD, follow these steps:
- Select
3for GBP as the source currency. - Select
4for CAD as the target currency. - Enter
100as the amount. - The output will display the converted amount in CAD.
The program consists of a switch statement in two steps:
- Conversion to INR: Converts the source currency to INR using predefined exchange rates.
- Conversion from INR: Converts the INR amount to the target currency.
- Live Exchange Rates: Integrate with an API to fetch real-time exchange rates.
- Error Handling: Enhance validation for more robust user interaction.
- Additional Currencies: Support more currencies beyond the six currently available.