SE Cons Assignment 1
SE Cons Assignment 1
www.icp.edu.pk
ASSIGNEMENT NO:-1
INTRODUCATION TO
SOFTWARE
CONSTRUCTION
Name:- Farman Ullah
Roll No:- 221135
BSSE Section (A)
Submitted by:
Farman Ullah
Submission Date:
05/12/2024
Currency Converter Documentation
Overview
The Currency Converter program allows users to convert an amount from one currency to
another. It provides a graphical user interface (GUI) where users can select the source
currency, target currency, and enter an amount. Once the user clicks the "Convert" button, the
program calculates the converted amount and displays the result.
Features
Currency Selection: The user can choose the source and target currencies from a
dropdown list.
Amount Input: The user can enter the amount to be converted.
Conversion Calculation: The program converts the entered amount from the source
currency to the target currency using predefined conversion rates.
Error Handling: If the user enters an invalid amount or if no amount is entered, the
program will display an error message.
Result Display: The converted amount is displayed in a non-editable field with the
appropriate currency symbol.
Technologies Used
Java Swing: The program uses Java Swing for creating the graphical user interface
(GUI). Swing provides a set of lightweight components to build rich user interfaces.
GridBagLayout: The layout manager used for organizing the components in the GUI
for a flexible and professional design.
Event Handling: Action listeners are used to handle user interactions, such as
clicking the "Convert" button.
Basic Java I/O: To handle input and output (amounts and conversion results).
CurrencyConverter Class
This is the main class of the application. It sets up the GUI and handles user interactions.
Constructor:
Method:
ConvertButtonListener Class
This is an inner class that implements the ActionListener interface. It is responsible for
handling the "Convert" button click event.
Method:
GUI Components
The currency conversion is done based on predefined rates for different currency pairs.
Below is an overview of the conversion logic:
Additional currency pairs can be added in the convertCurrency method with appropriate
conversion rates.
The program features a modern, clean, and professional user interface inspired by banking
applications, with the following design elements:
Background Color: A dark blue color (#1E2A47) is used to give the application a
professional, banking-like feel.
Button Color: The "Convert" button is styled with a green background (#4CAF50),
making it stand out as an action button.
Input Fields: The fields for entering the amount and displaying the result have a light
blue background (#D6E4F0) to visually differentiate them from other components.
Font: Arial font is used for text fields and labels to provide a clean, professional look.
If the user enters an invalid amount (non-numeric input), a pop-up error message is
displayed, prompting the user to enter a valid number.
If the amount field is left empty, an error message appears asking the user to enter
an amount before proceeding with the conversion.
1. Launching the Application: When the program is run, a window opens with fields to
enter the amount, select the source and target currencies, and display the result.
2. Performing Conversion:
o The user selects "USD" as the source currency and "EUR" as the target
currency.
o The user enters "100" as the amount to be converted.
o After clicking the "Convert" button, the program calculates the converted
amount (100 USD to EUR), displaying the result (85 EUR) in the result field.
Limitations
The program uses static conversion rates for simplicity. In a real-world application,
the rates should be fetched from an API to ensure they are up-to-date.
Only a small set of currencies are supported. More currencies can be added by
extending the convertCurrency method.
Future Improvements