0% found this document useful (0 votes)
13 views12 pages

Ajp 44

Uploaded by

abhi966512
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
13 views12 pages

Ajp 44

Uploaded by

abhi966512
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 12

Stopwatch

MAHARASHTRA STATE BOARD OF

TECHNICAL EDUCATION

Vidyavardhini Institute Of Technology, Pal,

Gargoti

MICRO PROJECT

Academic Year: 2024-25

TITLE OF PROJECT

“Stopwatch”
Program: Computer Engineering Program code:CO5I

Course: AJP Course code: 22517

V.V.I.T. Pal pg. 1


Stopwatch

Board Of Technical Education

Certificate
This is to certify that Roll no.44 of V Semester of Diploma in Computer Engineering of

Institute, VVIT, Pal (Code: 1207) has completed the Micro Project satisfactorily in Subject

AJP for the academic year 2024-25 as prescribed in the curriculum.

SR.NO NAME ROLL.NO Enrollment No Seat No

1 Randhir Ravindra Patil 44 2212070069 240729

Subject Teacher Head of the Department Principle

V.V.I.T. Pal pg. 2


Stopwatch

INDEX

SR.NO CONTENT PAGE


NO

1
Introduction 4

2 Advantages 5

3 Disadvantages 6

4 Application 7

5
Program 8

6 Output 11

7 Conclusion 12

V.V.I.T. Pal pg. 3


Stopwatch

Introduction

A stopwatch is a simple yet essential device that allows individuals to


accurately measure time intervals, track durations, and manage their activities with
precision. Whether it's for personal fitness routines, laboratory experiments, or sports
events, stopwatches play a crucial role in various domains. This micro project aims to
design and create a functional stopwatch using readily available electronic
components, making it an excellent opportunity for individuals interested in
electronics, programming, and projects to gain hands-on experience.

V.V.I.T. Pal pg. 4


Stopwatch

Advantages

➢ Precision: Stopwatches provide accurate timing, making them essential for


tasks where precise measurements of time intervals are required, such as in
sports, scientific experiments, and cooking.

➢ Ease of Use: Stopwatches are user-friendly and straightforward, typically


featuring large buttons for starting, stopping, and resetting the timer.

➢ Instant Feedback: Users can quickly view elapsed time, enabling them to
make timely decisions or adjustments during various activities.
➢ Versatility: Stopwatches come in various forms, from analog to a digital,
handheld to digital wristwatches, and can be adapted to suit different needs and
preferences

➢ Portability: Many stopwatches are compact and portable, making them easy
to carry and use on the go, which is particularly useful for sports, fitness
training, and outdoor activities.

➢ Long Battery Life: Battery-powered stopwatches can provide extended use


without the need for frequent replacements.

V.V.I.T. Pal pg. 5


Stopwatch

Disadvantages

➢ Limited Functionality: Basic stopwatches are primarily designed for time


measurement and may lack other features found in modern devices like
smart phones or smart watches.

➢ Limited Memory: Basic stopwatches may not have memory storage to


record and recall previous time measurements.

➢ Display Readability: In some lighting conditions, the digital display on a


stopwatch may be difficult to read. Some models may lack backlit
displays, which can be a disadvantage in low-light environments

V.V.I.T. Pal pg. 6


Stopwatch

Applications

➢ Sports and Athletics:

- Timing races, sprints, and marathons.

- Monitoring the duration of training sessions and workouts.

- Recording lap times for swimmers, runners, and cyclists.

- Measuring rest intervals between exercises.

➢ Fitness and Exercise:

-Timing rest intervals between sets during weightlifting and strength


training.

- Measuring the duration of aerobic exercises and high-intensity


intervals.

- Monitoring heart rate recovery time after a workout.

➢ Event Timing:

-Managing and timing events such as meetings, conferences, and


seminars.

-Timing speeches, presentations, and performances.

- Ensuring that scheduled activities run on time at conferences and


conventions.

➢ Game Timing:

-Timing board games, card games, and sports matches.

- Managing chess and tournament clocks.

- Keeping track of turn lengths and game durations

V.V.I.T. Pal pg. 7


Stopwatch

Program

import javax.swing.*;
import java.awt.*;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;

public class Stopwatch extends JFrame implements ActionListener {


private JLabel timeLabel;
private JButton startButton, stopButton, resetButton;
private Timer timer;
private int elapsedTime = 0; // Time in milliseconds

public Stopwatch() {
// Set up the frame
setTitle("Stopwatch");
setSize(300, 150);
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
setLayout(new BorderLayout());

// Time display label


timeLabel = new JLabel(formatTime(elapsedTime), SwingConstants.CENTER);
timeLabel.setFont(new Font("Arial", Font.BOLD, 30));
add(timeLabel, BorderLayout.CENTER);

// Buttons
JPanel buttonPanel = new JPanel();
buttonPanel.setLayout(new FlowLayout());

startButton = new JButton("Start");


stopButton = new JButton("Stop");
resetButton = new JButton("Reset");

startButton.addActionListener(this);
stopButton.addActionListener(this);
resetButton.addActionListener(this);
V.V.I.T. Pal pg. 8
Stopwatch

buttonPanel.add(startButton);
buttonPanel.add(stopButton);
buttonPanel.add(resetButton);

add(buttonPanel, BorderLayout.SOUTH);

// Timer logic
timer = new Timer(100, e -> {
elapsedTime += 100; // Update every 100 milliseconds
timeLabel.setText(formatTime(elapsedTime));
});
}

private String formatTime(int milliseconds) {


int seconds = (milliseconds / 1000) % 60;
int minutes = (milliseconds / 60000) % 60;
int hours = (milliseconds / 3600000);
return String.format("%02d:%02d:%02d", hours, minutes, seconds);
}

@Override
public void actionPerformed(ActionEvent e) {
if (e.getSource() == startButton) {
timer.start();
} else if (e.getSource() == stopButton) {
timer.stop();
} else if (e.getSource() == resetButton) {
timer.stop();
elapsedTime = 0;
timeLabel.setText(formatTime(elapsedTime));
}
}

public static void main(String[] args) {


SwingUtilities.invokeLater(() -> {
Stopwatch stopwatch = new Stopwatch();
stopwatch.setVisible(true);
V.V.I.T. Pal pg. 9
Stopwatch

});
}
}

V.V.I.T. Pal pg. 10


Stopwatch

Output

Main Stopwatch Start Stopwatch

V.V.I.T. Pal pg. 11


Stopwatch

Conclusion

In practical terms, the stopwatch developed in this project can find


applications in sports, scientific experiments, cooking, and many other areas
where accurate time measurement is crucial. It can serve as a valuable tool for
individuals and professionals seeking a cost-effective and customizable solution
for their timekeeping needs. For future work, we can explore additional
features, such as lap timing, data storage, and data export capabilities, to
enhance the stopwatch's functionality and usability.

V.V.I.T. Pal pg. 12

You might also like