0% found this document useful (0 votes)
9 views11 pages

Self Health Care System

Uploaded by

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

Self Health Care System

Uploaded by

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

SelfHealthCareSystem

--------------------------------------------------------------------------------------------------------------------------------------
--------------------------------------------------------------------------------------------------------------------------------------

Aim : to develop a java application to implement the User, Hospital, Tablet,


Appointment, and the self healthcare system

Algorithm

SelfHealthCareSystem

1. Display welcome message.

2. Show main menu options (Login, Register, Exit).

3. Upon login, redirect to the user menu.

4. Provide options to view hospitals, order tablets, book appointments, view


appointments, logout, or exit.

5. Handle user interactions and execute respective functionalities.

2. User

1. Store user attributes like name, date of birth, email, phone number, address,
and password.

2. Provide methods to access these attributes (getters).

3. Hospital

1. Store hospital attributes.

2. Provide methods to get hospital details.

3. Optionally, manage availability (not shown in current code but can be


added).

4. Tablet

1. Store tablet attributes.

2. Provide methods to get tablet details and manage quantity.

5. Appointment

1. Store appointment attributes.


2. Provide methods to display appointment details.

Algorithms for Core Functionalities

User Login

1. Prompt user for username and password.

2. Search for the user in the registered users list.

3. If found, set the user as current user and mark as logged in; otherwise, prompt for retry.

User Registration

1. Collect user details (username, password, date of birth, email, phone number, address).

2. Create a new User object and add it to the registered users array.

3. Confirm successful registration.

View Available Hospitals

1. Iterate through the hospitals array.

2. Display the name and address of each hospital.

Order Tablets

1. Display available tablets and their details.

2. Prompt user for tablet selection and quantity.

3. Check if the selected tablet is available.

4. Collect user details (name, age, address, phone number) and ask for prescription
confirmation.

5. If prescription is confirmed, deduct quantity and confirm order.

Book Appointment

1. Collect patient details (name, age, phone number).

2. Display available hospitals and ask for selection.

3. Collect desired appointment date and time.

4. Create an Appointment object and store it in the appointments array.

View Appointments

1. Iterate through the appointments array.

2. Display all booked appointments.


Program;

import java.time.LocalDate;

public class User {

private String username;

private LocalDate dateOfBirth;

private String email;

private String phoneNumber;

private String city;

private String password;

public User(String username, LocalDate dateOfBirth, String email, String phoneNumber, String
city, String password) {

this.username = username;

this.dateOfBirth = dateOfBirth;

this.email = email;

this.phoneNumber = phoneNumber;

this.city = city;

this.password = password;

public String getUsername() {

return username;

public String getPassword() {

return password;

public String getName() {


return username; // or modify to return user's name if available

public class Hospital {

private String name;

private String address;

private String phoneNumber;

public Hospital(String name, String address, String phoneNumber) {

this.name = name;

this.address = address;

this.phoneNumber = phoneNumber;

public String getName() {

return name;

public String getAddress() {

return address;

public String getPhoneNumber() {

return phoneNumber;

@Override

public String toString() {

return name + " - " + address + " - Phone: " + phoneNumber;

}
}

public class Tablet {

private String name;

private double price;

private int quantity;

public Tablet(String name, double price, int quantity) {

this.name = name;

this.price = price;

this.quantity = quantity;

public String getName() {

return name;

public double getPrice() {

return price;

public int getQuantity() {

return quantity;

public void setQuantity(int quantity) {

this.quantity = quantity;

@Override

public String toString() {

return name + " - Price: " + price + ", Available: " + quantity;
}

public class Appointment {

private String patientName;

private int age;

private String phoneNumber;

private String date;

private String time;

private String hospitalName;

public Appointment(String patientName, int age, String phoneNumber, String date, String time,
String hospitalName) {

this.patientName = patientName;

this.age = age;

this.phoneNumber = phoneNumber;

this.date = date;

this.time = time;

this.hospitalName = hospitalName;

@Override

public String toString() {

return "Appointment{" +

"Patient Name='" + patientName + '\'' +

", Age=" + age +

", Phone Number='" + phoneNumber + '\'' +

", Date='" + date + '\'' +

", Time='" + time + '\'' +

", Hospital='" + hospitalName + '\'' +

'}';

}
}

Output;

C:\java program>javac user.java

C:\java program>javac Hospital.java

C:\java program>javac Tablet.java

C:\java program>javac Appointment.java

C:\java program>javac SelfHealthCareSystem.java

C:\java program>java SelfHealthCareSystem

=====================================

Welcome to Self Health Care Site

=====================================

Main Menu:

1. Login

2. Register

3. Exit

Choose an option:2

Enter your name: george

Enter your age: 30

Enter your phone number: 9876543210

Enter your address: 123 Main St

Enter your email: [email protected]

Enter your proof ID (Aadhar/PAN): AADHAR1234

Enter your desired username: johndoe2024

Enter your desired password: password123


Enter the OTP: 123456

OTP verified successfully! Your account is now active.

Main Menu:

1. Login

2. Register

3. Exit

1.

Enter Username: care2024

Enter Password: 2024

Login successful! Welcome,

Main Menu:

1. View Available Hospitals

2. Order Tablets

3. Book an Appointment

4. View Appointments

5. Logout

6. Exit

Choose an option:1

Available Hospitals:

1. Hospital 1 - Address 1 - Phone: 1234567890

2. Hospital 2 - Address 2 - Phone: 1234567891

3. Hospital 3 - Address 3 - Phone: 1234567892

User Menu:

1. View Available Hospitals

2. Order Tablets

3. Book an Appointment

4. View Appointments

5. ESIC Claim

6. Logout
7. Exit

Choose an option: 2

Available Tablets:

1. Tablet 1 - Price: $5.0 - Quantity: 10

2. Tablet 2 - Price: $10.0 - Quantity: 8

3. Tablet 3 - Price: $15.0 - Quantity: 5

Enter Tablet Number to order: 1

Enter Name: George

Enter Age: 21

Enter Address: 123 Main St

Enter Phone Number: 9876543210

Do you have a doctor’s prescription? (yes/no): yes

Order confirmed! Prescription details have been shown to the delivery member.

User Menu:

1. View Available Hospitals

2. Order Tablets

3. Book an Appointment

4. View Appointments

5. ESIC Claim

6. Logout

7. Exit

Choose an option: 3

Booking an Appointment:

Enter Patient Name: George

Enter Age: 21

Enter Phone Number: 9876543210

Available Hospitals:

1. Hospital 1 - Address 1

2. Hospital 2 - Address 2

3. Hospital 3 - Address 3
Select a hospital (1-3): 1

You selected: Hospital 1

Enter desired date (dd/MM/yyyy): 25/10/2024

Enter desired time (HH:mm): 10:00

Appointment booked for 25/10/2024 at 10:00 in Hospital 1.

User Menu:

1. View Available Hospitals

2. Order Tablets

3. Book an Appointment

4. View Appointments

5. ESIC Claim

6. Logout

7. Exit

Choose an option: 4

Your Appointments:

1.Patient Name: George, Age: 21, Phone: 9876543210, Date: 25/10/2024, Time: 10:00,
Hospital: Hospital 1

User Menu:

1. View Available Hospitals

2. Order Tablets

3. Book an Appointment

4. View Appointments

5. ESIC Claim

6. Logout

7. Exit

Choose an option: 5

Enter Username: esic2024

Enter Password: 2024

Login successful! Welcome, esic2024


Enter Company Name: ABC Corp

Enter Employee Code: 123456

Enter Hospital Name: Hospital 1

Enter Amount: $200

Amount will be deducted from Hospital 1. Claim processed successfully!

User Menu:

1. View Available Hospitals

2. Order Tablets

3. Book an Appointment

4. View Appointments

5. ESIC Claim

6. Logout

7. Exit

Choose an option: 7

Result; thus the java application to implement to implement the User, Hospital,
Tablet, Appointment, and the self healthcare system was implemented and executed
successfully

--------------------------------------------------------------------------------------------------------------------------------------

You might also like