A simple Java-based currency converter that uses hardcoded exchange rates to convert between USD, EUR, GBP, MYR, and JPY. Includes error handling for invalid inputs and negative amounts. Ideal for beginners learning Java.
- Convert between USD, EUR, GBP, MYR, and JPY using fixed exchange rates.
- Handles invalid inputs and negative values gracefully.
- Console-based interface with a simple user prompt.
- Clone the repository:
git clone https://github.com/nurulashraf/java-currency-converter.git
- Navigate to the project folder:
cd java-currency-converter
- Compile the Java program:
javac src/CurrencyConverter.java
- Run the program:
java -cp src CurrencyConverter
Enter source currency (USD, EUR, GBP, MYR, JPY): USD
Enter target currency (USD, EUR, GBP, MYR, JPY): MYR
Enter amount to convert: 10
10.00 USD = 47.00 MYR
java-currency-converter/
│── src/
│ ├── CurrencyConverter.java # Main Java program
│── README.md # Project documentation
│── LICENSE # MIT License file
This project is licensed under the MIT License - see the LICENSE file for details.