Skip to content

Adding Currency Convertor example #3307

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

DEVANSH-GAJJAR
Copy link

Pull Request Template

What does this PR do?

This PR adds a new example implementation of the Currency Converter design pattern in Java.
The example demonstrates a basic currency conversion utility that converts between multiple currencies using fixed exchange rates.

It showcases the application of the Strategy pattern by allowing different conversion strategies to be swapped easily.
This helps learners understand how to decouple conversion logic and improve flexibility in financial applications.

Copy link

github-actions bot commented Jul 28, 2025

PR Summary

This PR adds a Java example of a Currency Converter that uses the Strategy pattern. It demonstrates converting between currencies using fixed exchange rates and allows different conversion strategies to be easily swapped. The example uses okhttp for HTTP requests and org.json for JSON handling.

Changes

File Summary
currency-convertor/currency-convertor/.gitignore This file is added to ignore specific files and folders during Git operations. It helps maintain a clean repository by excluding build artifacts, IDE-specific files, and other unnecessary files.
currency-convertor/currency-convertor/pom.xml This file is a Maven project object model (POM). It defines project details, dependencies, and build configurations. The dependencies include okhttp for HTTP requests and org.json for JSON handling.
currency-convertor/currency-convertor/src/main/java/com/currencyconvertor.java This Java class implements a currency converter using the okhttp library to fetch exchange rates from an external API and org.json for JSON parsing. It takes user inputs for source and target currencies and quantity, then prints the converted amount.
currency-convertor/currency-convertor/src/main/java/org/example/Main.java This is a simple Java class that contains a main method. It currently prints a welcome message and a simple loop, but it's likely a placeholder or starting point for a more extensive application.

autogenerated by presubmit.ai

Copy link

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

Review Summary

Commits Considered (1)
  • a38bb65: Adding Currency Convertor example
Files Processed (4)
  • currency-convertor/currency-convertor/.gitignore (1 hunk)
  • currency-convertor/currency-convertor/pom.xml (1 hunk)
  • currency-convertor/currency-convertor/src/main/java/com/currencyconvertor.java (1 hunk)
  • currency-convertor/currency-convertor/src/main/java/org/example/Main.java (1 hunk)
Actionable Comments (0)
Skipped Comments (0)

Copy link

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant