Java Mini Project...... 11-1
Java Mini Project...... 11-1
Guided By
PROF. Ms. Sarita Bopalkar
CERTIFICATE
This is to certify that Mr/Miss Tejas Shelar, Hemant Vaidya, Kaustubh Prabhu,
Shivam Rajeshirke of Class SE (AIML) has performed the experiments mentioned
durin g the academic year 2023-2024 and has successfully completed all the practicals
in the subject of OOPs as prescribed by the University of Mumbai.
. .
Mrs.Sarita Bopalkar Mrs. S.N. Deshpande
Tejas Shelar
Hemant Vaidya
Kaustubh Prabhu Shivam
Rajeshirke
Date:
ABSTRACT
The project aims to develop a user- values between Indian Rupee (INR) and United
States Dollar (USD). The application will provide a simple and intuitive interface for
users to enter an amount in one currency and obtain the equivalent value in the other
currency based on real-time exchange rates.
User Interface (UI): The application will feature a responsive and intuitive interface
allowing users to input the amount in either INR or USD and select the desired
conversion direction. The UI will display the converted amount promptly and clearly.
Conversion Logic: The backend will handle the actual conversion process. It will use
accurate and updated exchange rates obtained from a reliable financial data source or
API to perform precise currency conversions. The logic will encompass both INR to
USD and USD to INR conversions.
Error Handling and Validation: The application will incorporate robust error handling
to manage scenarios like invalid user input, network issues, or unavailability of current
exchange rates. Proper validation will be implemented to ensure data accuracy and
user-friendly error messages.
Real-Time Exchange Rates: The project will explore integrating with external
financial APIs to fetch real-time exchange rates. These rates will ensure that the
conversions are accurate and reflective of the current market conditions.
⦁ Intelij
1
CONTENTS
Table of contents
2
INTRODUCTION
1. Currency Conversion:
⦁ Bidirectional Conversion: Allow users to convert both INR to USD and USD to
INR.
⦁ Real-Time Exchange Rates: Fetch and display the most up-to-date exchange
rates from a reliable source.
2. User Interface:
⦁ Intuitive Design: Offer a clean and user-friendly interface for easy input and
output of currency values.
⦁ Input Validation: Validate user inputs to prevent errors and handle edge cases
gracefully.
3
⦁ Offline Support: Handle scenarios when the application is unable to fetch
realtime rates due to a lack of internet connectivity.
⦁ Tejas Shelar
⦁ Hemant Vaidya
⦁ Kaustubh Prabhu
⦁ Shivam Rajeshirke
A brief :
Functionality: Currency converters take an input value in one currency and use the
current exchange rate to provide the equivalent value in another currency.
Exchange Rates: The converter relies on exchange rates, which represent the value of
one currency in terms of another. These rates fluctuate due to various factors such as
economic conditions, geopolitical events, and market speculation.
User Input and Output: Users typically input the amount in the source currency and
select the target currency. The converter then computes and displays the converted
amount, considering the latest exchange rate.
4
Usability: Currency converters are used for a wide range of purposes, including
personal finance, international trade, travel, and more. They help individuals and
businesses make informed financial decisions by understanding the value of money in
different currencies.
Challenges: The accuracy of a currency converter heavily relies on the accuracy of the
exchange rates used. Fluctuating rates and potential fees from financial institutions for
currency conversion can also impact the final amount received.
• There are two text fields for input, one for Rupees (INR) and one for Dollars
(USD).
5
By default, both are set to "0."
• There are two buttons, one for converting from INR to USD and another for
converting from USD to INR.
• When the user enters a value in one text field and clicks the respective conversion
button, the program performs the currency conversion based on a fixed exchange
rate (83.04 INR to 1 USD in this case).
GUI Components:
Two JLabels for "Rupees" and "Dollars."
Two JTextFields for entering values in rupees and dollars.
Three JButtons for converting from rupees to dollars, from dollars to rupees, and for
closing the application.
A JFrame to contain these GUI components.
Event Handling:
ActionListeners are added to the "INR" and "Dollar" buttons to handle the currency
conversion logic.
An ActionListener is added to the "close" button to exit the
application. A WindowListener is used to handle window closing
events.
Conversion Logic:
The code contains logic to convert between rupees and dollars based on a conversion
factor (83.04).
Display:
The GUI elements are positioned and displayed within the JFrame.
6
Application Execution:
The main method calls the converter() function to initialize and display the
application.
IMPLEMENTATION
Theory:
Inorder to make an android application one should have a good
knowledge of JAVA,Object Oriented Programming and Android
Development.
JAVA:
JAVA language is first developed in may 1995, at Sun
Microsystem by James Gosling.JAVA supports Object Oriented
Programming. And this fact allows us to do a lot of things in Java. Java is
used in all kinds of applications like Mobile Applications (Android is
Java- based), desktop applications, web applications, client-server
applications, enterprise applications, and many more. Basic
Terminologies in JAVA:
7
⦁ Functions and methods
These terminologies are the basics of JAVA and is must when it comes to
programming. Theobject-oriented programming is based upon these only. In
android development, everything isused. Below is the definition of some of the
terminologies of JAVA.
Variables: A variable is a container which holds the value while the Java
program is executed.A variable is assigned with a data type.
Methods: A method is a block of code or collection of statements or a set of code
groupedtogether to perform a certain task or operation. It is used to achieve the
reusability of code.
Input / Output: Java brings various Streams with its I/O package that helps the
user to performall the input-output operations. These streams support all the types
of objects, data-types, characters, files etc. to fully execute the I/O operations.
Object-Oriented Programming:
JAVA uses OOP concept for programming. This allows the
language to do a lot of things. JAVA uses Classes and objects, to make the
code more readable and efficient. In the project, while using Java for its
programming, a dense amount of OOP has been implemented.The
following terminologies can be found in the use:
⦁ Polymorphism
⦁ Abstraction
⦁ Inheritance
8
⦁ Encapsulation
⦁ Interface
⦁ Overriding
A class contains:
⦁ data member
⦁ method
⦁ constructor
⦁ nested class and
⦁ interface
9
SOFTWARE DEVLOPMENT
We have this class named as ‘Book’ which is used to manage the list crated in Library
class. Software development is the process of creating computer programs and
applications using various programming languages and tools. To build software,
developers need to master atleast one programming language that enables them to
define the functionality of the application.Software development typically comprises
two main components: the front-end and the back end. The choice of programming
language depends on the platform and the specific requirements ofthe software. The
development process includes writing code, testing, and debugging to create
functional and user-friendly applications.
The following text is code of the .javafile where the programming part of the
application is done..This is the part of main class which calls the function from the
subclasses.
import
javax.swing.JOptionPane;
javax.swing.JFrame { public
CurrencyConverter() {
initComponents();
10
jButton1.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jButton1ActionPerformed(evt);
}
});
txtAmount.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
txtAmountActionPerformed(evt);
}
});
javax.swing.GroupLayout(jPanel1);
jPanel1.setLayout(jPanel1Layout);
11
jPanel1Layout.setHorizontalGroup(
jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.A
lignment.LEADING)
.addGroup(jPanel1Layout.createSequentialGroup()
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.Group
Layout.Alignment.LEADING)
.addGroup(jPanel1Layout.createSequentialGroup()
.addGap(35, 35, 35)
.addGroup(jPanel1Layout.createParallelGroup(javax.sw
ing.GroupLayout.Alignment.TRAILING, false)
.addComponent(jLabel3,
javax.swing.GroupLayout.DEFAULT_SIZE,
javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(jLabel2,
javax.swing.GroupLayout.Alignment.LEADING,
javax.swing.GroupLayout.DEFAULT_SIZE,
javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(jLabel1,
javax.swing.GroupLayout.DEFAULT_SIZE, 88, Short.MAX_VALUE))
.addPreferredGap(javax.swing.LayoutStyle.Component
Placement.UNRELATED)
.addGroup(jPanel1Layout.createParallelGroup(javax.sw
ing.GroupLayout.Alignment.LEADING, false)
.addComponent(jButton1,
javax.swing.GroupLayout.PREFERRED_SIZE, 210,
javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(txtAmount)
.addComponent(txtFrom, 0, javax.swing.GroupLayout.DEFAULT_SIZE,
Short.MAX_VALUE)
.addComponent(txtTo, 0,
javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)))
.addGroup(jPanel1Layout.createSequentialGroup()
.addGap(151, 151, 151)
.addComponent(Convert, javax.swing.GroupLayout.PREFERRED_SIZE,
171,
javax.swing.GroupLayout.PREFERRED_SIZE)))
12
.addContainerGap(125, Short.MAX_VALUE))
);
jPanel1Layout.setVerticalGroup(
jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel1Layout.createSequentialGroup()
.addContainerGap()
.addComponent(jButton1,
javax.swing.GroupLayout.PREFERRED_SIZE, 57,
javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.
UNRELATED)
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.Group
Layout.Alignment.BASELINE)
.addComponent(txtAmount,
javax.swing.GroupLayout.PREFERRED_SIZE, 45,
javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jLabel1,
javax.swing.GroupLayout.PREFERRED_SIZE, 45,
javax.swing.GroupLayout.PREFERRED_SIZE))
.addGap(18, 18, 18)
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.Group
Layout.Alignment.BASELINE)
.addComponent(jLabel2,
javax.swing.GroupLayout.PREFERRED_SIZE, 47,
javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(txtFrom, javax.swing.GroupLayout.PREFERRED_SIZE, 42,
javax.swing.GroupLayout.PREFERRED_SIZE))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.
UNRELATED)
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.Group
Layout.Alignment.LEADING, false)
.addComponent(jLabel3,
javax.swing.GroupLayout.PREFERRED_SIZE, 56,
javax.swing.GroupLayout.PREFERRED_SIZE)
.addGroup(jPanel1Layout.createSequentialGroup()
.addComponent(txtTo)
13
.addGap(18, 18, 18)))
.addGap(78, 78, 78)
.addComponent(Convert,
javax.swing.GroupLayout.PREFERRED_SIZE, 54,
javax.swing.GroupLayout.PREFERRED_SIZE)
.addContainerGap(23, Short.MAX_VALUE))
);
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addContainerGap()
.addComponent(jPanel1,
javax.swing.GroupLayout.DEFAULT_SIZE,
javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addContainerGap())
);
layout.setVerticalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addContainerGap()
.addComponent(jPanel1,
javax.swing.GroupLayout.DEFAULT_SIZE,
javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addContainerGap())
);
pack();
setLocationRelativeTo(null);
}// </editor-fold>//GEN-END:initComponents
14
txtAmountActionPerformed(java.awt.event.ActionEvent evt) {//GEN-
FIRST:event_txtAmountActionPerformed
// TODO add your handling code here:
}//GENLAST:event_txtAmountActionPerformed
}//GEN-LAST:event_ConvertActionPerformed
15
{ for (javax.swing.UIManager.LookAndFeelInfo info :
javax.swing.UIManager.getInstalledLookAndFeels()) { if
("Nimbus".equals(info.getName())) {
javax.swing.UIManager.setLookAndFeel(info.getClassName()); break;
}
}
} catch (ClassNotFoundException ex) {
java.util.logging.Logger.getLogger(CurrencyConverter.class.getName()).log(java.util.l
ogging.Level.SEVERE, null, ex);
} catch (InstantiationException ex) {
java.util.logging.Logger.getLogger(CurrencyConverter.class.getName()).log(java.util.l
ogging.Level.SEVERE, null, ex); } catch (IllegalAccessException ex) {
java.util.logging.Logger.getLogger(CurrencyConverter.class.getName()).log(java.util.l
ogging.Level.SEVERE, null, ex);
} catch (javax.swing.UnsupportedLookAndFeelException ex) {
java.util.logging.Logger.getLogger(CurrencyConverter.class.getName()).log(java.util.l
ogging.Level.SEVERE, null, ex);
}
java.awt.EventQueue.invokeLater(new Runnable() {
public void run() { new
CurrencyConverter().setVisible(true);
}
});
}
16
javax.swing.JComboBox<String> txtFrom; private
javax.swing.JComboBox<String> txtTo;
// End of variables declaration//GEN-END:variables }
Output:
17
18
METHODOLOGY
To learn Java there wasn’t any problem as it was being taught to us at our
college. Fromthere only that we learn to code in java using OOP. We also
used YouTube to learn various exceptional things that were necessary for the
application.
1
1. Start
2. Display a message asking the user to input the amount to be converted and the
choice of conversion (INR to USD or USD to INR).
3. Read the user's input for the amount and the conversion choice.
4. If the choice is INR to USD:
a. Read the amount in INR.
b. Convert the amount from INR to USD using the conversion rate (e.g., 1 USD
= 75 INR).
c. Display the converted amount in USD.
5. If the choice is USD to INR:
a. Read the amount in USD.
b. Convert the amount from USD to INR using the inverse of the conversion
rate.
c. Display the converted amount in INR.
6. If the user wants to perform another conversion:
a. Go back to step 2.
7. If the user wants to exit:
a. Display a closing message.
8. End
16
The following Tree diagram shows the basic hierarchy of the project.
17
Design of the Project :
1. Frontend (User Interface):
⦁ Input Section: Text field for entering the amount, radio buttons or dropdown for
choosing the conversion direction.
⦁ Display Section: Text field or label to display the converted amount.
3. Integration:
⦁ Connect the frontend and backend to ensure user interactions lead to the correct
conversion and display the results accurately on the UI.
18
ANALYSIS
Swing Components: The program uses various Swing components such as JFrame,
JLabel, JTextField, and JButton for creating the GUI.
GUI Elements: It creates two labels for "Rupees" and "Dollars" with corresponding
text fields to input the values.
Buttons:"INR" button: Converts the value from INR to USD when pressed. It
retrieves the value from the INR JTextField, performs the conversion, and displays the
result in the USD JTextField.
"Dollar" button: Converts the value from USD to INR when pressed. It retrieves the
value from the USD JTextField, performs the conversion, and displays the result in the
INR JTextField.
"close" button: Closes the application when pressed.
Action Listeners: Action listeners are added to the buttons to perform the conversion and
handle the closing of the application. These listeners respond to user interaction with the
GUI components.
Display and GUI Handling:It manages the layout using absolute positioning
(f.setLayout(null)), which might not be the best practice in GUI design. Using layout
managers is generally recommended for better responsiveness and adaptability. The
f.setSize(400, 300) sets the initial size of the window to be 400x300 pixels. Main
Method: The main method simply calls the converter method to start the currency
converter GUI.
19
RESULT
do so.
Duration: 2 months
I would like to give our special thanks of gratitude to our teacher Prof.
Vandana Shinde, who provided us with the beautiful task ofmaking a JAVA
application as the semester project. Through her that we found the light to help the
campus through our application. This project had been challenging to us at times
and it is our madam’s beliefin us that we find the motivation to do achieve our goal
in this.
We learn many things while making the application. Thanks to madam, that
she taught us about the JAVA programming and the OOPM subject. As it has a
major application in our project.
We would like to thank all the content creators and educators out there, who
are pouring immense amounts of knowledge at affordable rates in the world.
Without them the project would have been impossible to complete in the given
time period
I would like to thank our teachers for making us
competent in this world of constant change and learning. Because to teach
to learn is the greatest teaching one can give. Thank you all!