Currency Converter In Java
Currency Converter In Java
Place: Miraj.
Date: ……………
Team Members :
Oracle's Java
For reference and learning
5 Documentation documentation and N/A
purposes.
Swing tutorials
To ensure functionality
JUnit or similar for unit
7 Testing Framework 1 and reliability of the
testing
application.
4.0 Source Code and Output
import javax.swing.*;
import java.awt.*;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.text.DecimalFormat;
public Currency_Converter() {
setTitle("Currency Converter");
setLayout(new GridLayout(4, 2));
convertButton.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
try {
double amount = Double.parseDouble(amountField.getText());
String fromCurrency = (String)
fromComboBox.getSelectedItem();
String toCurrency = (String) toComboBox.getSelectedItem();
double exchangeRate = exchangeRates[getIndex(toCurrency)] /
exchangeRates[getIndex(fromCurrency)];
double result = amount * exchangeRate;
resultLabel.setText(decimalFormat.format(result) + " " +
toCurrency);
} catch (Exception ex) {
resultLabel.setText("Invalid input");
}
}
});
setSize(300, 200);
setVisible(true);
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
}
5.0. Conclusion
In conclusion, the Currency Converter project serves as a practical and educational tool that effectively
demonstrates the application of Java programming and graphical user interface (GUI) development
using the Swing framework. By successfully creating an intuitive and user-friendly application, this
project not only meets the essential need for currency conversion in a globalized economy but also
enhances the user experience through its clear layout and responsive design. The inclusion of multiple
currencies allows users to engage with a diverse range of financial scenarios, while the real-time
conversion feature, supported by predefined exchange rates, ensures that users receive accurate and
timely information. Furthermore, the project emphasizes the importance of robust error handling,
providing users with clear feedback for invalid inputs, which contributes to a more seamless interaction
with the application. As an educational resource, the Currency Converter project reinforces fundamental
programming concepts, such as event handling, data validation, and modular design, making it an
excellent learning experience for students and aspiring developers. Looking ahead, the potential for
future enhancements—such as integrating real-time exchange rates from external APIs, improving the
user interface, and expanding currency options—highlights the project's extensibility and relevance in
an ever-evolving technological landscape. Overall, the Currency Converter not only fulfills a practical
need but also serves as a testament to the capabilities of Java and the importance of user-centered
design in software development, paving the way for further exploration and innovation in financial
applications.
Note:
Every course teacher is expected to assign marks for group evolution for each group of students in first 3
columns as per rubrics & individual evaluation in 4TH column for each group of studentsas per rubrics
based on viva.
Signature………………………………………………………………………………
Date:……………………..