0% found this document useful (0 votes)
10 views

TSD

The document presents a project report for 'MedAssist: Basic Health Symptom Guide', a Java-based application designed to provide users with home remedy suggestions based on common health symptoms. It details the project's objectives, design, implementation, and future enhancements, including the potential integration of machine learning and external APIs. The application aims to empower users with preliminary health guidance while emphasizing that it is not a substitute for professional medical advice.
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)
10 views

TSD

The document presents a project report for 'MedAssist: Basic Health Symptom Guide', a Java-based application designed to provide users with home remedy suggestions based on common health symptoms. It details the project's objectives, design, implementation, and future enhancements, including the potential integration of machine learning and external APIs. The application aims to empower users with preliminary health guidance while emphasizing that it is not a substitute for professional medical advice.
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/ 38

MedAssist: BASIC HEALTH SYMPTOM

GUIDE
MINOR PROJECT REPORT

SUBMITTED IN PARTIAL FULFILMENT OF THE REQUIREMENTS FOR THE AWARD


OF THE DEGREE OF

BACHELOR OF TECHNOLOGY
(Department of Artificial Intelligence)

Submitted By: Submitted To.:


Sakshi B (23010040) Prof. Aparitosh Gahakari
Aanchal K (23010015) Assistant Professor
Dejirani M (23010058)
Nayana D (23010027)

Department of Artificial Intelligence


St. Vincent Pallotti College of Engineering and Technology, Nagpur

1
ST. VINCENT PALLOTTI COLLEGE OF
ENGINEERING AND TECHNOLOGY-NAGPUR
DEPARTMENT OF ARTIFICIAL INTELLIGENCE

CERTIFICATE

Certified that this project report “MedAssist: Basic Health Symptom Guide” is
the bonafide work of SAKSHI BANSOD , AANCHAL KALAMBE, DEJIRANI
MATE and NAYANA DHOTE who carried out the micro project work under
my supervision in partial fulfillment of IV Semester, Bachelor of Engineering in
ARTIFICIAL INTELLIGENCE of RASHTRASANT TUKADOJI MAHARAJ
NAGPUR UNIVERSITY, NAGPUR.

Dr. Vikas Bhowate Prof. Aparitosh Gahankari


Head of Department Assistant Professor, AI Department
ARTIFICIAL INTELLIGENCE GUIDE

2
Abstract

MedAssist: Basic Health Symptom Guide is a software application developed to


provide users with immediate home remedy suggestions and wellness advice
based on common health symptoms. The system features a symptom database
linked to relevant recommendations and utilizes object-oriented programming
principles in Java for efficient data management.
This project demonstrates the potential of technology to offer accessible
preliminary health guidance, empowering users to make informed decisions
about their well-being.
Future development aims to expand the symptom database, integrate external
APIs (including AI), enhance the user interface (potentially with mobile and voice
capabilities), incorporate machine learning for predictive analysis, personalize
user profiles, and explore integration with healthcare systems. MedAssist
represents a foundational step towards leveraging software for improved health
awareness and self-care.

3
Acknowledgement

We would like to express our sincere gratitude to Prof. Aparitosh Gahakari for his
invaluable guidance and support throughout this project.
Our appreciation extends to Department of Artificial Intelligence, SVPCET
Nagpur and our educators for providing the foundational knowledge.
We acknowledge our peers, Sakshi Bansod, Aanchal Kalambe, Dejirani Mate and
Nayana Dhote for their helpful discussions and contributions.
Furthermore, we recognize the developers of the open-source tools and libraries
utilized in this project. Finally, we thank potential future users and contributors.
This project was made possible by the collective support and resources provided
by these individuals and entities.

4
List of Figures

Figure Title Page No.


No.

Figure 1.1 System Architecture 9

Figure 3.1 Data Flow Diagram(DFD) 14

Figure 3.2 Data Dictionary 15

Figure 3.3 UML Class Diagram of MedAssist 15


Application
Figure 5.1 Screenshot 1: Initial User Interface 24

Figure 5.2 Screenshot 2: Output Display 25


(i and ii)
Figure 5.3 Screenshot 3: Error Dialog 26

5
TABLE OF CONTENTS

Contents Page No.


_______________________________________________________________
Certificate i
Abstract ii
Acknowledgement iii
List of Figures iv
Table of Contents v

Chapter 1: Introduction 7-9

Chapter 2: Requirement Analysis and System Specification 10-12

Chapter 3: System Design 13-16

Chapter 4: Implementation, Testing and Maintenance 17-21

Chapter 5: Results and Discussions 22-26

Chapter 6: Conclusion and Future Scope 27-30

Appendix A: Development Environment 31-37

6
Chapter 1: Introduction

1.Introduction to Project
MedAssist is a user-friendly Java-based application developed to provide basic
healthcare suggestions based on common symptoms like fever, cold, and
headache. Designed with object-oriented programming principles and enhanced
with a graphical user interface (GUI) using Java Swing, this application aims to
serve as a quick reference guide, offering home remedies and advice for when to
consult a doctor. MedAssist is not a replacement for medical consultation but
provides initial guidance for users.

2.Project Category
Category: Application or System Development
This project falls under Application Development as it involves building a
standalone desktop application using core Java concepts including object-
oriented programming, exception handling, multithreading, and GUI
programming with Swing.

3.Objectives
 To develop a Java application that assists users with health suggestions
based on input symptoms.
 To implement object-oriented programming concepts like inheritance,
polymorphism, and interfaces.
 To utilize Java packages, exception handling, arrays, and multithreading in
a single integrated application.
 To provide a clean GUI interface that enhances user experience.
 To simulate background processing (like loading suggestions) using
multithreading.

7
4.Problem Formulation
In many cases, individuals encounter minor health symptoms but hesitate to
consult a doctor immediately. They often seek quick and reliable suggestions or
home remedies. However, finding accurate and consolidated information can be
confusing or misleading. There's a need for a simplified, non-diagnostic tool that
guides users in understanding common symptoms and potential remedies, along
with indicators for when medical attention is required.

5.Identification/Reorganization of Need
There is a growing trend of self-care, especially for minor ailments. People often
use online platforms or health forums for suggestions, which may not be
trustworthy. A localized, lightweight, and quick-response application that offers
non-diagnostic health suggestions based on symptoms would meet this need
effectively. MedAssist reorganizes and simplifies this need into a Java
application, ensuring reliability and clarity for end-users.

6.Existing System
In the existing scenario:
 People use websites or apps like WebMD or Google search to find
remedies.
 These platforms often require internet connectivity and sometimes
overwhelm the user with too much information.
 Most systems are either too complex or part of large healthcare suites not
focused solely on basic symptom assistance.

7.Unique Features of the System


 Offline Use: Works completely without internet connectivity.
 Modular Design: Built using packages for easy maintenance and
scalability.
 Multithreaded UI Simulation: Uses background threads to simulate real-
time suggestion loading.
 OOP Principles: Inherits and overrides methods for flexible logic design.
 Custom Exception Handling: Gracefully handles invalid user inputs.

8
 Array and String Logic: Efficient storage and search of symptom-
suggestion pairs.

8.Proposed System

Figure 1.1 System Architecture

9
Chapter 2: Requirement Analysis and
System Specification

1.Feasibility Study
 Technical Feasibility
The project is technically feasible as it utilizes Java, a well-supported,
object-oriented programming language. Development tools like JDK and
VS Code are open-source, lightweight, and widely used. The application
does not require any third-party APIs or network resources, allowing it to
run efficiently on local machines without dependencies.

 Economical Feasibility
The development of the project is cost-effective since all required tools and
resources are freely available. No licensing fees or hardware upgrades are
necessary. It is suitable for students and educational institutions with
limited budgets.

 Operational Feasibility
The application is simple to operate, requiring only basic user input to
generate useful health-related suggestions. It can be used on any computer
system with a Java environment, making it accessible and operationally
feasible for the target users.

2.Software Requirement Specification (SRS)


 Data Requirements
 A predefined list of health symptoms and their corresponding
suggestions.

 Storage and retrieval of this data using arrays or collections.

 Ability to extend the data using configuration files (optional future


improvement).
 Functional Requirements

 Allow user to input common symptoms (e.g., fever, headache, cold).

10
 Process user input to match known symptoms.

 Display home remedies and suggest when to consult a doctor.

 GUI version: Provide a form-based interface with text fields and


buttons.

 Multithreading to handle suggestion loading in the background.

 Performance Requirements
 Quick response time for user queries.

 No delay in suggestion loading due to background processing.

 Low memory and CPU usage to ensure performance on basic


systems.

 Dependability Requirements
 Input validation to ensure the program handles unknown symptoms
gracefully.

 Consistent performance for repeated inputs.

 Reliable error handling using exception mechanisms.

 Maintainability Requirements
 Code is divided into multiple packages for better modularity.

 Follows object-oriented principles like inheritance and interface


implementation.

 Easy to update and extend by adding new symptoms and


suggestions.
 Security Requirements
 Since this is a local, standalone application, security concerns are
minimal.

 Input validation ensures no unexpected behavior or misuse of the


system.
11
 Internal methods are protected using proper access modifiers.

 Look and Feel Requirements


 Console version: Simple and readable text prompts and output.

 GUI version: Clean layout, user-friendly navigation, consistent


design.

 Clear labels, tooltips, and messages to guide user interaction.

3.Validation
 Each user input is validated to check against predefined symptoms.

 Custom exception handling ensures robustness against invalid


entries.

 Functional testing verifies that suggestions are correctly matched


and displayed.

 GUI components are tested for responsiveness and usability.

4.Expected Hurdles
 Spelling errors or typos in user input may lead to symptom
mismatch.

 GUI layout issues may arise when scaling the interface for more
features.

 Proper management of threads to avoid UI lag or unexpected


behavior.
 Keeping the code modular as the system expands with more
symptoms and features.

12
Chapter 3: System Design

1. Design Approach: Object-Oriented Approach


The project follows the Object-Oriented Design (OOD) approach to model the
system as a collection of interacting objects, each defined by their roles and
behaviors. This approach enhances modularity, reusability, and maintainability.

Key object-oriented principles used include:


 Encapsulation: Data and behavior are wrapped within classes.

 Inheritance: SpecificSymptom inherits from Symptom.

 Polymorphism: The getSuggestions() method is overridden to provide


symptom-specific responses.

 Interfaces: The Displayable interface defines the method to show


suggestions.

2. Detail Design
The system consists of the following core classes:

 UserInput: Handles user interactions and input.

 Symptom: A base class representing a general symptom.

 SpecificSymptom: Inherits from Symptom and provides custom


suggestions.

13
 SuggestionEngine: Retrieves suggestions based on symptoms.

 HealthGuideApp: The main class that coordinates user interaction and


displays results.

 SuggestionLoader: A thread class to simulate background loading of


suggestions.
These classes are logically grouped into packages like com.medassist.symptoms,
com.medassist.ui, com.medassist.utils, and com.medassist.suggestions.

3. System Design Tools


1. Data Flow Diagram (DFD)

Figure 3.1 Data Flow Diagram(DFD)

14
3.Data Dictionary

Figure 3.2 Data Dictionary

3. UML Class Diagram:

Figure 3.3 UML Class Diagram of MedAssist Application

15
4. User Interface Design
 Console Version:
 Simple text input for symptoms
 Clear output of suggestions
 Error messages for invalid inputs
 GUI Version (Swing):
 JTextField for user input
 JButton to submit
 JTextArea for displaying suggestions
 Tooltips and labels for guidance
5. Database Design
For now, the application uses arrays or hardcoded data for symptoms and
remedies. However, for future expansion, a small relational database can be used.
6. Normalization
 The schema is already normalized to 3NF:
 No repeating groups (1NF)
 Each non-key attribute depends on the whole primary key (2NF)
 No transitive dependency (3NF)
 Database Manipulation (Future Scope)
 Use SQL commands to insert, update, and query symptom-suggestion
pairs.
 Option to load data dynamically from the database instead of hardcoding.
 Database Connection Controls and Strings (Future Scope)
 JDBC (Java Database Connectivity) can be used.

7.Methodology
Development Methodology:
The Iterative Waterfall Model has been followed in this project. Initial
development focused on building the basic console application. Later,
enhancements like GUI and multithreading were added in a phased manner. Each
phase allowed improvements and debugging of the previous iteration.

16
Chapter 4: Implementation, Testing, and
Maintenance
1. Introduction to Languages, IDEs, Tools and Technologies Used
for Implementation
The implementation of the MedAssist project was carried out using the Java
programming language. Java was chosen due to its platform independence,
object-oriented features, and widespread usage in both academic and industrial
applications. The Java Swing library was used for building a basic graphical user
interface (GUI), while the initial version was built using the standard console-
based interface.
The primary tools and technologies used include:
 Programming Language: Java 21

 IDE: Visual Studio Code (VS Code)

 Compiler: OpenJDK 21 (with manual javac and java usage via Command
Prompt)

 Build & Execution Tools: Command-line scripts (javac, java, -cp classpath
configuration)

 Threading: Java’s built-in Thread class to simulate background task


execution

 Swing GUI: For developing the GUI version of the system

 UML Design: Draw.io (for class diagrams and flowcharts)

 Documentation: Microsoft Word

17
2. Coding Standards of Language Used
The following coding standards and conventions were followed throughout the
development process:
Naming Conventions:
 Class names follow PascalCase (e.g., UserInput, SpecificSymptom)

 Variable and method names follow camelCase (e.g., getSymptom(),


symptomName)

 Constants (if any) use uppercase with underscores (e.g.,


MAX_SUGGESTIONS)

Code Structure:

 Use of access modifiers (private, public) to encapsulate class members

 Each class was kept in its respective file and package to maintain
modularity

 Exception handling was used for invalid symptom input

 Methods were kept concise with a single responsibility

 Documentation & Comments:

 Inline comments were added to describe important logic

18
 Each class has a header comment stating its purpose

3. Project Scheduling Using Various Tools


To ensure timely delivery and smooth tracking of progress, the following
scheduling tools were considered:

PERT (Program Evaluation Review Technique):


 Used to identify critical activities such as:

 Designing the class structure

 Coding core functionalities

 Integrating multithreading and GUI

 Final testing and debugging

GANTT Chart:
 A timeline view was created manually in Excel to track:

 Requirements gathering: 2 days

 Design: 3 days

 Implementation: 5 days

19
 Testing: 2 days

 Documentation: 3 days

OpenProj (Alternative):
An optional tool for creating and visualizing project timelines and resource
allocation.
Dependencies and milestones were mapped for each module development.

4. Testing Techniques and Test Plans


The testing phase was crucial to ensure that the system performs accurately across
different inputs. The following strategies were used:

Testing Techniques:
 Unit Testing: Each class was tested individually, especially the
getSuggestions() method of SpecificSymptom

 Integration Testing: Verified the interaction between modules like


UserInput, SuggestionEngine, and SuggestionLoader

 Exception Testing: Ensured the Invalid Symptom Exception works


correctly

 GUI Testing: Tested the responsiveness of Swing components and the


correctness of displayed suggestions

20
Test Cases:

Test Case ID Input Expected Output Result


TC001 fever Suggestions for fever Pass
TC002 headache Suggestions for headache Pass
TC003 unknown input InvalidSymptomException Pass
is thrown
TC004 empty input Exception handled Pass
gracefully
TC005 GUI input Suggestions displayed in Pass
Swing window

Test Plan:
Phase 1: Test console version completely.

Phase 2: Validate threading functionality (loader delay).

Phase 3: Test GUI with valid/invalid inputs.

Phase 4: Cross-check test cases and document results.

21
Chapter 5: Results and Discussions

5.1 User Interface Representation


The user interface (UI) of MedAssist was designed using Java Swing, providing
a responsive and intuitive experience for users. The focus was on simplicity and
clarity, ensuring users of any background can operate the system without prior
technical knowledge.

The main interface includes the following components:


 JLabel: To display static text like instructions ("Enter a symptom:")

 JTextField: For users to enter a symptom like "fever", "cold", or


"headache".

 JButton: Triggers the suggestion engine when clicked (labeled "Get


Suggestions").

 JTextArea: Displays a list of home remedies or suggestions in a scrollable


area.

 JOptionPane: Used for displaying warnings or error dialogs when input is


invalid.

The layout follows a clean vertical flow using layout managers, making it easy to
read and operate. Colors and font styling have been chosen to reduce eye strain
and emphasize key interactions.

22
5.2 Brief Description of Various Modules of the System
1. UserInput Module
 Captures input from the user through GUI elements.

 Validates input to ensure it's not empty or irrelevant.

 If invalid, throws a custom InvalidSymptomException.

2. Symptom & SpecificSymptom Classes


 Implements the core OOP concepts:

 Inheritance: SpecificSymptom inherits from Symptom.

 Polymorphism: getSuggestions() is overridden to provide symptom-


specific logic.

 These classes serve as a model layer in the project architecture.

3. SuggestionEngine
 Acts as the logic handler.

 Contains mappings of known symptoms to a list of home remedies.

 Returns suggestions based on user input using string matching and


keyword checks.

23
4. SuggestionLoader (Multithreading)
 Extends the Thread class.

 Loads suggestions in a background thread to simulate delay (like from an


online server).

 Helps demonstrate use of multithreading and synchronization in a real-


world context.

5. GUI Layer (HealthGuideApp)


 Manages user interactions and integrates all other modules.

 Designed using Java Swing components.

 Uses event-driven programming to respond to button clicks and display


outputs.

5.3 Snapshots of System with Brief Detail


Screenshot 1: Initial User Interface
This shows the welcome message, input field for the symptom, and the "Get
Suggestions" button.

24
Figure 5.1 Screenshot 1: Initial User Interface

Screenshot 2: Output Display


Upon entering a valid symptom like "headache" or “fever”, suggestions are
loaded and displayed in the text area after a short delay.

Figure 5.2(i) Screenshot 2: Output Display

25
Figure 5.2(ii) Screenshot 2: Output Display

Screenshot 3: Error Dialog


When the user enters an invalid or unsupported symptom, a dialog box appears
with a custom error message, powered by exception handling.

Figure 5.3 Screenshot 3: Error Dialog

26
5.4 Back-End Representation (Database to Be Used)
Currently, the application does not use an external database. Instead, it relies on
predefined data structures (like arrays and hash maps) within the
SuggestionEngine class to manage symptoms and their remedies.

Why no DB now?
Simple use-case doesn’t require persistent storage.
Helps maintain portability and ease of execution across machines.

Future Plans:
If scaled further, a database like SQLite or MySQL can be used to:
 Store an extensive list of symptoms and suggestions.
 Track user interaction history or preferences.
 Enable admin-level symptom/medicine management.

27
Chapter 6: Conclusion and Future Scope

6.1 Conclusion

In this project, we developed “MedAssist: Basic Health Symptom Guide”, a


simple yet efficient system designed to provide users with home remedies and
wellness advice based on various health symptoms. The goal of this application
is to offer immediate suggestions and guidance for common health conditions,
empowering users to make informed decisions about their well-being.

The core features of the project include:


 A Symptom Database: A repository of common symptoms with
corresponding remedies and advice, which can be expanded and updated
as needed.
 Symptom-based Suggestions: The application offers practical suggestions
based on the user's input, ensuring that they receive accurate and relevant
health tips.
 User-Friendly Interface: The simple and straightforward design ensures
that even those with minimal technical knowledge can easily interact with
the system.

Through the implementation of this project, we have learned to apply object-


oriented programming principles, particularly inheritance and encapsulation, to
model real-world entities like health symptoms and their remedies. We have also
gained valuable experience in Java programming, working with classes, methods,
and data structures like arrays and HashMaps to store and retrieve information
efficiently.

Moreover, the project demonstrates the practical application of technology in the


healthcare sector. It highlights the potential of software solutions to support
healthcare professionals and individuals in making informed health decisions,
especially when access to medical professionals is not immediately available.

28
6.2 Future Scope

While the current version of MedAssist offers a basic functionality for health
advice, there are many opportunities for further enhancement and expansion.
Some potential directions for future development include:

6.2.1 Expanding the Symptom Database


 Incorporating More Symptoms: The current database contains a limited set
of symptoms. In the future, the system could be expanded to include a wide
range of symptoms across different medical conditions (e.g., digestive
issues, skin conditions, mental health concerns).

 User Contributions: Allow users to contribute their own health suggestions


or remedies for specific symptoms, creating a community-driven database.

 Medical Integration: Link the symptom database with verified medical


sources and guidelines (e.g., WHO, CDC) for more accurate and reliable
suggestions.

6.2.2 Integration with External APIs


 API Integration: In the future, MedAssist could be enhanced by integrating
with external APIs that provide real-time health advice, symptom checkers,
or medical databases. For instance, integrating with WebMD or Healthline
APIs could allow the system to fetch up-to-date, authoritative health
information.

 AI Integration: Artificial intelligence models could be incorporated to


provide more personalized advice based on user health data, history, and
symptoms. Natural Language Processing (NLP) could be used to allow
users to describe their symptoms in their own words, and AI could interpret
the input to provide better suggestions.

29
6.2.3 User Interface Enhancements
 Mobile Application: To make the system more accessible, a mobile app
version could be developed for both Android and iOS. This would allow
users to access the health advice directly from their smartphones, making
it easier to use in emergencies or on the go.

 Voice Assistant: A voice-enabled feature could be integrated to allow users


to simply speak their symptoms instead of typing them, making the
application even more user-friendly, especially for those who may have
difficulty typing.

 Visual Design Improvements: Incorporate a more aesthetically pleasing


and interactive user interface (UI) using tools like JavaFX or Swing, which
could enhance the overall user experience.

6.2.4 Machine Learning and Predictive Analysis


 Predictive Health Monitoring: By analyzing a user's historical symptoms
and advice usage, machine learning algorithms could predict potential
future health issues and offer preventive advice.
 Severity Prediction: Using data from users, MedAssist could predict the
severity of a symptom and advise the user on whether they should seek
medical attention immediately or if home remedies would suffice.
 Symptom Clustering: Clustering algorithms like K-means could be used to
group similar symptoms together, making it easier for users to identify
related health conditions.

6.2.5 Personalization and User Health Profiles


 Health Profiles: Future versions of the system could allow users to create
profiles, storing their health history, preferences, and past symptoms. This
would enable MedAssist to offer more tailored suggestions and better track
users' health over time.
 Personalized Reminders: MedAssist could send personalized reminders for
the user to take prescribed medications, follow-up on health checks, or
maintain a healthy lifestyle based on their past health data.
30
6.2.6 Integration with Healthcare Systems
 EHR Integration: MedAssist could be integrated with Electronic Health
Records (EHRs) to provide health advice based on a user’s medical history.
This integration would allow for more precise and relevant health tips.

 Doctor Consultation: An integrated telemedicine feature could allow users


to directly schedule a consultation with a healthcare professional based on
the symptoms they input, providing an end-to-end solution from diagnosis
to consultation.

6.3 Conclusion
The MedAssist project has proven to be an insightful journey into the application
of software solutions in the healthcare domain. The future scope of this project is
vast, offering ample opportunities to innovate and enhance the system in ways
that can significantly impact how individuals approach health and wellness.
Whether through the expansion of symptom databases, integration with AI, or
further UI enhancements, MedAssist has the potential to become a powerful tool
for users seeking reliable health advice.

By continuously improving and expanding the system, MedAssist could


contribute to creating a more informed, health-conscious society. As the field of
health tech continues to grow, the project can evolve to meet emerging needs,
providing users with even more value and support in managing their health
effectively.

31
Appendix A: Development Environment

1. Hardware Requirements:

Component Specification

Processor Intel Core i5 or higher


RAM Minimum 8 GB
Storage Minimum 500 GB HDD / 256 GB
SSD
Operating System Windows 10/11 (64-bit)
Display 13" or larger with 1366x768
resolution

2. Software Requirements:

Software Version Purpose

Java Development Kit OpenJDK 21 Main programming language

VS Code (Visual Studio Latest Stable Code editing and project


Code) Release organization
Command Line / Built-in Running and compiling Java
Terminal (cmd/PowerShell) programs
Java Swing Libraries Built-in with JDK Creating GUI Interface

JVM (Java Virtual OpenJDK Default Runtime environment for Java


Machine) apps

32
3. Folder Structure:

To ensure organized and modular code, the project follows this folder structure:

MedAssistJavaProject/

├── src/
│ ├── com/
│ └── medassist/
│ ├── ui/ → User Interface Classes (Console & Swing)
│ ├── symptoms/ → Symptom-related classes
│ ├── suggestions/ → Logic for providing suggestions
│ ├── utils/ → Utility classes like SuggestionLoader
│ └── exceptions/ → Custom exception classes
├── out/ → Compiled class files
├── sources.txt → List of all .java files

4. Configuration Settings:

 JAVA_HOME: Set to the path of OpenJDK (e.g., C:\Program


Files\Java\jdk-21)
 Path Variable: Add %JAVA_HOME%\bin to the system PATH variable
 VS Code Extensions:
- Java Extension Pack
- Code Runner (to run Java directly inside editor)
- Java Debugger
 Terminal Setup:

33
- Use PowerShell or Command Prompt for compiling (javac) and running (java)
programs
- Compilation: javac -d out @sources.txt
- Execution: java -cp out com.medassist.ui.HealthGuideApp

5. Project Initialization Steps:

1. Install JDK 21 and configure environment variables.


2. Create folder structure as outlined above.
3. Write code in the respective packages (symptoms, suggestions, ui, etc.).
4. Compile the code using command line and sources.txt.
5. Run the application via terminal or using VS Code's Run option.

6. Code Snippets:

1. Class: Symptom (OOP – Base Class)


package com.medassist.symptoms;

public class Symptom {


protected String name;

public Symptom(String name) {


this.name = name;
}

public String[] getSuggestions() {


return new String[]{"General health suggestion."};
}

34
public String getName() {
return name;
}
}

2. Class: SpecificSymptom (Inheritance + Polymorphism)


package com.medassist.symptoms;

public class SpecificSymptom extends Symptom {


public SpecificSymptom(String name) {
super(name);
}

@Override
public String[] getSuggestions() {
switch (name.toLowerCase()) {
case "fever":
return new String[]{"Stay hydrated", "Take paracetamol", "Rest
well"};
case "headache":
return new String[]{"Avoid bright lights", "Apply balm", "Take rest"};
default:
return super.getSuggestions();
}
}
}

35
3. Class: SuggestionEngine (Business Logic Layer)
package com.medassist.suggestions;

import com.medassist.symptoms.SpecificSymptom;

public class SuggestionEngine {


public String[] getSuggestions(String symptomName) {
SpecificSymptom symptom = new SpecificSymptom(symptomName);
return symptom.getSuggestions();
}
}

4. Class: UserInput (Utility for Input Collection)


package com.medassist.utils;

import java.util.Scanner;

public class UserInput {


private static final Scanner scanner = new Scanner(System.in);

public static String getSymptom() {


System.out.print("Enter a symptom (e.g., fever, headache): ");
return scanner.nextLine();
}
}

36
5. Class: SuggestionLoader (Multithreading + Synchronization)
package com.medassist.utils;

import com.medassist.suggestions.SuggestionEngine;

public class SuggestionLoader extends Thread {


private final String symptom;
private final SuggestionEngine engine;

public SuggestionLoader(String symptom, SuggestionEngine engine) {


this.symptom = symptom;
this.engine = engine;
}

@Override
public void run() {
synchronized (this) {
System.out.println("\n Loading suggestions for: " + symptom + "...");
String[] suggestions = engine.getSuggestions(symptom);
System.out.println("\n Suggestions:");
for (String s : suggestions) {
System.out.println("- " + s);
}
}
}
}

37
6. Main Class: HealthGuideApp (Entry Point)
package com.medassist.ui;

import com.medassist.utils.UserInput;
import com.medassist.utils.SuggestionLoader;
import com.medassist.suggestions.SuggestionEngine;

public class HealthGuideApp {


public static void main(String[] args) {
System.out.println("Welcome to MedAssist - Your Health Guide");

String symptom = UserInput.getSymptom();


SuggestionEngine engine = new SuggestionEngine();

SuggestionLoader loader = new SuggestionLoader(symptom, engine);


loader.start();

try {
loader.join();
} catch (InterruptedException e) {
System.out.println("Error loading suggestions.");
}

System.out.println("Thank you for using MedAssist!");


}
}

38

You might also like