AJP Report
AJP Report
A STUDY ON
Group Number: 24
Roll.no
Sr.no Name of student Enrollment No Seat No
Certificate
This is to certify that Mr. / Ms. _______________________________________
Dhule (Institute Code: 0059) has completed the Micro Project satisfactorily in
Seal of
institute
MAHARASHTRA STATE BOARD OF TECHNICAL
EDUCATION, MUMBAI
Certificate
This is to certify that,
Roll No Enrollment No Name Exam Seat No.
Seal of
institute
Part A: Micro-Project Proposal
Title: Currency Converter INR ₹ to USD $
1.0 Introduction:
This project aims to create a currency Calculator using Java's Swing framework, providing a
user-friendly interface for performing basic currency conversions operations.
By developing this Currency Calculator, we will enhance our understanding of Java
programming and GUI design, demonstrating key concepts such as event handling and user
interaction. Ultimately, this project serves as a practical tool for learning and applying
programming skills in a real-world application.
4.0Literature Review:
Java Swing is a popular toolkit for building platform-independent GUI applications, offering
components like JFrame, JButton, and JTextField, which are ideal for creating a simple
calculator. Swing's flexibility and event-driven model, based on ActionListener, make it
suitable for handling user interactions efficiently. Previous research and tutorials demonstrate
how Swing enables the development of functional calculators by managing button events and
real-time display updates. This project builds on established principles of GUI design and
event-driven programming to create an interactive desktop calculator using Java Swing.
5.0Proposed Methodology:
For our Java Swing-based Currency Calculator project, start by defining the coversions of
INR₹ to USD$. Use JFrame as the main window, with a JTextField for the display and
JButtons for numbers and operators, arranged using a GridLayout for proper alignment. Each
button should trigger an action through ActionListener to update the display or perform
calculations.
In implementation, focus on designing a class structure with a main class (e.g.CalculatorApp)
that extends JFrame, handling button clicks and ensuring correct calculation logic.
Thoroughly test the functionality, including edge cases like dividing by zero or handling
large numbers.
Sr.
Name of Resource/Material Specifications Quantity Remarks
No.
4. Documentation
5. Demonstration
Part B: Micro-Project Report
Title: Currency Converter INR ₹ to USD $
1.0 Rationale:
This project is designed to enhance understanding of Java Swing for GUI development and
event-driven programming. Creating a calculator offers practical experience with Java
components like JButton and JTextField, while developing essential skills in handling user
inputs through ActionListeners. It provides a real-world application with a simple, user-
friendly interface, laying the foundation for future desktop application development.
Additionally, it emphasizes problem-solving and logical reasoning in translating everyday
tools into functional software solutions.
panel.add(numberButtons[4]); // Row 3
panel.add(numberButtons[5]);
panel.add(numberButtons[6]);
panel.add(addButton);
panel.add(numberButtons[1]); // Row 4
panel.add(numberButtons[2]);
panel.add(numberButtons[3]);
panel.add(eqButton);
panel.add(decButton); // Row 5
panel.add(numberButtons[0]);
panel.add(new JLabel("")); // Empty space for alignment
add(panel);
setVisible(true);
}
@Override
public void actionPerformed(ActionEvent e) {
// Number input handling
for (int i = 0; i < 10; i++) {
if (e.getSource() == numberButtons[i]) {
display.setText(display.getText() + i);
operatorPressed = false; // Reset flag after number input
}
}
// Decimal button handling
if (e.getSource() == decButton) {
String currentText = display.getText();
// Check for decimal in the current operand (before or after operator)
if (operatorPressed) {
String[] parts = currentText.split("[" + operator + "]");
if (parts.length > 1 && !parts[1].contains(".")) {
display.setText(currentText + ".");
}
} else {
if (!currentText.contains(".")) {
display.setText(currentText + ".");
}
}
}
// Clear display
if (e.getSource() == clrButton) {
display.setText("");
num1 = num2 = result = 0;
}
// Delete last character
if (e.getSource() == delButton) {
String currentText = display.getText();
display.setText(currentText.length() > 0 ? currentText.substring(0,
currentText.length() - 1) : "");
}
// Operator button handling
if (e.getSource() == addButton || e.getSource() == subButton || e.getSource() ==
mulButton || e.getSource() == divButton) {
num1 = Double.parseDouble(display.getText());
operator = e.getActionCommand().charAt(0);
display.setText(display.getText() + " " + operator + " ");
operatorPressed = true; // Flag that operator is pressed
}
// Equals button handling
if (e.getSource() == eqButton) {
String[] parts = display.getText().split(" ");
if (parts.length < 3) return;
num1 = Double.parseDouble(parts[0]);
operator = parts[1].charAt(0);
num2 = Double.parseDouble(parts[2]);
switch (operator) {
case '+':
result = num1 + num2;
break;
case '-':
result = num1 - num2;
break;
case '*':
result = num1 * num2;
break;
case '/':
if (num2 != 0)
result = num1 / num2;
else {
display.setText("Cannot divide by zero");
return;
}
break;
}
display.setText(String.valueOf(result));
num1 = result; // Store the result to allow chaining
}
}
public static void main(String[] args) {
new Calculator4();
}
}
Sr.
Name of Resource/Material Specifications Quantity Remarks
No.
RAM: 8 GB