Skip to content

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

Notifications You must be signed in to change notification settings

stanlykanukula/Java_HMS

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

2 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

πŸ₯ Hospital Management System

A Java console application that models hospital personnel and demonstrates foundational OOP concepts:
Encapsulation, Inheritance, Method Overriding, Upcasting, and Downcasting.


🎯 Objective

Build a straightforward Hospital Management System in Java where different roles share common structure but expose role-specific behavior, illustrating how object-oriented design maps to real-world entities.


βœ… Requirements

1. πŸ”’ Encapsulation

  • Base class Person with private fields:
    • name (String)
    • age (int)
    • gender (String)
  • Accessible through public getters and setters.

2. 🧬 Inheritance

  • Four subclasses extending Person:
    • Doctor β†’ adds specialization (String)
    • Nurse β†’ adds qualification (String)
    • Patient β†’ adds disease (String)
    • Receptionist β†’ adds shift (String)

3. πŸ” Method Overriding

  • Each subclass overrides a details() method to print its own information.

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

  • Upcasting: Treat Doctor, Nurse, Patient, and Receptionist as Person references to demonstrate polymorphism.
  • Downcasting: Safely revert to subclasses (with instanceof checks) to access their specific fields.

πŸ“ Project Structure


β”œβ”€β”€ src/
β”‚ └── Hms/
β”‚ β”œβ”€β”€ Person.java
β”‚ β”œβ”€β”€ Doctor.java
β”‚ β”œβ”€β”€ Nurse.java
β”‚ β”œβ”€β”€ Patient.java
β”‚ β”œβ”€β”€ Receptionist.java
β”‚ β”œβ”€β”€ Main.java # entry point
β”‚ └── module-info.java
β”œβ”€β”€ .classpath
β”œβ”€β”€ .project
β”œβ”€β”€ .gitignore
└── README.md

πŸ’» Sample Output

name: Dr. Alekhya, age: 33, gender: Female
Doctor Specialization :Neuro
----------------------------------
name: Ravi, age: 60, gender: Male
Patient disease :Braintumor
----------------------------------
name: Mamatha, age: 32, gender: Female
Reciptionist Shift :night
----------------------------------
name: Ramu, age: 29, gender: Male
Nurse Qualification :nursing
----------------------------------

πŸ› οΈ Technologies Used

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

About

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

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages