Document of IT-1-19
Document of IT-1-19
Abstract:
This project focuses on the development of a Fitness Tracker
Application utilizing Java for the frontend and MySQL for the backend. The
application is designed to help users monitor and manage their physical
activities, health metrics, and fitness goals. The Java-based frontend
provides an interactive and user-friendly interface where users can input
data such as steps taken, calories burned, distance covered, and heart
rate. The backend, powered by MySQL, securely stores this data, enabling
users to track their progress over time and set personal fitness goals.
The front end of the application, developed using Java, offers an intuitive
and responsive graphical user interface (GUI). This interface enables
users to toga wide range of fitness metrics including steps taken, distance
covered, calories burned, and heart rate. Java's object-oriented
capabilities allow for the implementation of modular and reusable code,
ensuring a flexible and maintainable design. The front end is engineered
for smooth user interaction, featuring real-time data updates, progress
tracking, and user-specific feedback. The system will also integrate
validation mechanisms to ensure the accuracy and integrity of user input.
1. System Architecture:
The system follows a client-server architecture, where the client-side is
developed using Java for the user interface, and the server-side backend
is powered by MySQL for data storage and management. The architecture
is divided into the following core components:
- Goal Table: Tracks personalized fitness goals set by users, linked via
foreign keys to individual users.
First, create a MySQL database and table for storing the user fitness data.
, , , sql
user_name VARCHAR(S0),
date DATE,
steps INT,
distance_km DOUBLE,
calories_burned DOUBLE
);
Step 2: Java Program: FitnessTracker.java
do{
choice = scanner.nextlnt();
switch (choice) {
case 1:
logFitnessActivity(scanner);
break;
case 2:
viewFitnessLogs();
break;
case 3:
break;
default:
System.out.println("lnvalid choice, please try again.,,);
scanner. close();
PreparedStatement preparedStatement =
conn.prepareStatement(insertSQL);
preparedStatement.setString(2, date);
preparedStatement.setDouble(S, caloriesBurned);
if (rowslnserted > 0) {
} catch (SQLException e) {
}
I I Method to view all fitness logs from the database
PreparedStatement preparedStatement =
conn.prepareStatement(selectSQL);
while (resultSet.next()) {
double caloriesBurned =
resultSet.getDouble("calories_burned");
} catch (SQLException e) {
1. Database Connection:
- ' DB_ URL ' , ' USER· , and · PASS · are used to establish a connection to
the MySQL database using JDBC.
2. Menu-Driven Interface:
- The program provides a simple text-based menu for logging new fitness
activity and viewing existing logs.
- This data is inserted into the ' fitness_log' table using an ' INSERT
INTO ' SQL query.
1. Ensure your MySQL server is running and you've created the database
and table as outlined in **Step 1**.
3. Enter the required data (user name, date, steps, etc.) when prompted
and view the stored data as needed.