Skip to content

The Hospital Management System is a Java project demonstrating OOP concepts like inheritance, method overriding, upcasting, and downcasting. It includes a base Person class with subclasses like Doctor, Nurse, Patient, and Receptionist to model real-world hospital roles.

Notifications You must be signed in to change notification settings

KanugantiHaripriya/pentaGon-hms-java-project1-2

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

3 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

πŸ₯ Hospital Management System - Java Project-1-2

🎯 Objective

Design a simple Hospital Management System in Java demonstrating key OOP concepts such as:

  • Encapsulation
  • Inheritance
  • Method Overriding
  • Upcasting
  • Downcasting

βœ… Requirements

1. πŸ”’ Encapsulation

Create a base class Person with private fields:

  • name (String)
  • age (int)
  • gender (String)
    Provide public getter and setter methods for these fields.

2. 🧬 Inheritance

Create four subclasses extending the Person class:

  • Doctor

    • Additional field: specialization (String)
  • Nurse

    • Additional field: qualification (String)
  • Patient

    • Additional field: disease (String)
  • Receptionist

    • Additional field: shift (String)

3. πŸ” Method Overriding

Override the details() method in all subclasses to display specific role details.


4. πŸ”ΌπŸ”½ Upcasting and Downcasting

  • Upcasting:
    Assign Doctor, Nurse, Patient, and Receptionist objects to Person type references.

  • Downcasting:
    Convert Person references back to subclass references to access subclass-specific properties.


πŸ“ Project Structure

.settings/
src/
└── Project1example/
    β”œβ”€β”€ Doctor.java
    β”œβ”€β”€ Nurse.java
    β”œβ”€β”€ Patient.java
    β”œβ”€β”€ Person.java
    β”œβ”€β”€ Receptionist.java
    β”œβ”€β”€ Test.java
    └── module-info.java
.classpath
.project
.gitignore
README.md

πŸ’» Sample Output

Name: Dr. Alekhya, Age: 33, Gender: Female
The specialization of the doctor is Dentist
--------------------------------------------------
Name: Ramu, Age: 29, Gender: Male
The Qualifcation of Nurse is B.Sc Nursing
---------------------------------------------------
Name: Ravi, Age: 60, Gender: Male
The patient is suffering with Diabetes
---------------------------------------------------
Name: Mamatha, Age: 32, Gender: Female
The Receptionist is working in Morning shift

πŸ› οΈ Technologies Used

  • Java (OOP Concepts)
  • Eclipse IDE (or any preferred Java IDE)

About

The Hospital Management System is a Java project demonstrating OOP concepts like inheritance, method overriding, upcasting, and downcasting. It includes a base Person class with subclasses like Doctor, Nurse, Patient, and Receptionist to model real-world hospital roles.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages