MICROPROJECT REPORT
Java Programming (314317)
TOPIC: GUI-Based Temperature Tracker
1.0 RATIONALE:
In today's fast-paced world, temperature monitoring plays a crucial role in various domains, including
healthcare, agriculture, environmental monitoring, and industrial applications. A GUI-Based
Temperature Tracker provides a user-friendly interface to record, display, and analyze temperature
variations efficiently.
2.0 AIMS AND BENEFITS OF THE MICROPROJECT :
1. Real-time Monitoring: Enables users to track temperature changes over time.
2. User-Friendly Interface: Provides an intuitive GUI for easy interaction and data visualization.
3. Data Logging & Analysis: Stores past temperature data for trend analysis and future reference.
4. Multi-source Input: Can fetch temperature data from user input, APIs (e.g., OpenW eatherMap), or
sensors.
3.0 COU RSE OU TCOMES ADDRESSES:
o CO1: Develop Java Program using classes and objects.
o CO2: Develop Java Program for implementing code reusability concept.
o CO3: Develop Java Program to implement multithreading and exception handling.
o CO4: Develop Java Program for implementing event-handling using window-based application
components.
4.0 ACTUAL METHODOLOGY FOLLOW ED
1. Systematic Approach to Developmen t
2. Structured Methodology for Implemen tation
3. Phased Developmen t Strategy
4. Design an d Implemen tation Framew ork
5. Developmen t Lifecycle an d W ork fl ow
6. Step-by-Step Process for System Developmen t
7. Methodical Approach to System Design
8. Softw are Developmen t Methodology
9. Implemen tation Strategy an d W ork fl ow
10. Process Model for Application Developmen t
5.0 Actual resources used:
Sr. n o Name of Specification Qty Remark
resources / s
material
1. Person al W in dow s 11 02 -
computer w ith suitable
softw are
2. Java 01 -
Sor ftw are
6.0 Code :
import javax.swing.;
import java.aw t.;
import java.awt.event.*;
public class TempTrackerGUI extends JFrame implements ActionListener { JTextField tempFields[] = new
JTextField[7]; JButton calculateButton; JLabel resultLabel;
TempTrackerGUI() {
setTitle("Temperature Tracker");
setSize(450, 450);
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
setLayout(new BorderLayout(10, 10));
JLabel instruction = new JLabel("Enter temperatures for 7 days:", SwingConstants.CENTER);
add(instruction, BorderLayout.NORTH);
JPanel inputPanel = new JPanel(new GridLayout(7, 2, 5, 5));
for (int i = 0; i < 7; i++) {
inputPanel.add(new JLabel("Day " + (i + 1) + ":"));
tempFields[i] = new JTextField();
inputPanel.add(tempFields[i]);
}
add(inputPanel, BorderLayout.CENTER);
calculateButton = new JButton("Calculate");
resultLabel = new JLabel("", SwingConstants.CENTER);
calculateButton.addActionListener(this);
JPanel bottomPanel = new JPanel(new GridLayout(2, 1, 5, 5));
bottomPanel.add(calculateButton);
bottomPanel.add(resultLabel);
add(bottomPanel, BorderLayout.SOUTH);
setVisible(true);
}
public void actionPerformed(ActionEvent e) {
float sum = 0, max, min;
int maxDay = 0, minDay = 0;
float[] temperatures = new float[7];
for (int i = 0; i < 7; i++) {
try {
temperatures[i] = Float.parseFloat(tempFields[i].getText());
sum += temperatures[i];
} catch (NumberFormatException ex) {
resultLabel.setText("Enter valid numbers!");
return;
}
}
float avg = sum / 7;
max = min = temperatures[0];
for (int i = 1; i < 7; i++) {
if (temperatures[i] > max) {
max = temperatures[i];
maxDay = i;
}
if (temperatures[i] < min) {
min = temperatures[i];
minDay = i;
}
}
resultLabel.setText("Average: " + avg + " | Maximum: " + max + " (Day " + (maxDay + 1) + ")" +
" | Minimum: " + min + " (Day " + (minDay + 1) + ")");
}
public static void main(String args[]) {
new TempTrackerGUI();
}
}
7.0 Output:
Note: Output w hen characters or any thin g else than in tegers/fl oat values are en tered
7.0 Sk ills developed
Through the completion of this microproject, w e w ere able to en han ce our skills in the follow in g areas:
oGUI Development with Java Swing
oException Handling and Error Management
oData Processing and Logical Think ing
oProblem-Solving and Debugging
oSoftware Development Lifecycle (SDLC) Understanding
oUI/UX Design Considerations
8.0 Application of Micro project
Person al Temperature Loggin g
W eather An alysis
Healthcare Mon itorin g
Agriculture & Farmin g
In dustrial U se