Skip to content

his Java-based School Management System demonstrates core OOP concepts like inheritance, encapsulation, upcasting, and downcasting. It models real-world roles such as Staff, Teacher, and Principal with shared and specific behaviors. Static variables, methods, and blocks are used to manage common resources like the school name.

Notifications You must be signed in to change notification settings

KanugantiHaripriya/KanugantiHaripriya-pentaGon-sms-java-project2

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

🏫 School Management System – Java Project-2

📌 Objective

This project demonstrates core Object-Oriented Programming (OOP) principles using Java, including:

  • Inheritance: Building a class hierarchy of school staff.
  • Encapsulation: Securing class attributes using access modifiers.
  • Polymorphism: Achieved via upcasting and downcasting.
  • Static Concepts: Usage of static variables, methods, and static blocks for shared resources.

✅ Functional Requirements

1. 📂 Staff Class (Base Class)

  • Attributes (private):

    • String name
    • int age
    • String employeeId
  • Static Attribute:

    • String schoolName – shared by all staff members
  • Methods:

    • String work() – returns a string stating the staff is working.
    • String details() – returns staff details.
  • Static Methods:

    • void showSchoolName() – prints the school name.
  • Static Block:

    • Initializes the schoolName when the class is loaded.

2. 👩‍🏫 Teacher Class (Inherits from Staff)

  • Additional Attribute:

    • String subject
  • Methods:

    • void setSubject(String subject) – sets the teacher's subject.
    • String teach() – returns a message that the teacher is teaching the subject.
    • String details() – overrides parent method to include the subject info.

3. 👨‍💼 Principal Class (Inherits from Staff)

  • Additional Attribute:

    • int yearsOfExperience
  • Methods:

    • void setExperience(int experience) – sets the principal's experience.
    • String lead() – returns a message indicating leadership.
    • String details() – overrides parent method to include experience.

4. 🧪 Main Class (Demonstration)

Demonstrates the following concepts:

  • 🔒 Encapsulation – access and modify attributes via getter/setter methods.
  • 🔁 Upcasting – treat Teacher/Principal objects as Staff references to call shared methods.
  • 🔄 Downcasting – revert Staff reference to specific subclass to call unique methods.
  • 🧷 Static Variable/Method – shared schoolName is displayed using a static method.
  • Static Block – initializes static data when class is loaded.

📖 Concepts Covered

Feature Description
Inheritance Teacher and Principal extend Staff
Encapsulation Private attributes with public setters/getters
Upcasting Staff s = new Teacher()
Downcasting Teacher t = (Teacher) s
Static Methods/Vars Shared school name using static members
Static Block One-time initialization of static fields

🗂️ Project Structure

SchoolManagementSystem/
│
├── .classpath
├── .gitignore
├── .project
├── .settings/
│   ├── org.eclipse.core.resources.prefs
│   └── org.eclipse.jdt.core.prefs
│
├── src/
│   └── com/pentagon/smsp/
│       ├── Staff.java
│       ├── Teacher.java
│       ├── Principal.java
│       └── SMS.java    <-- Main class
│
└── module-info.java

💻 Sample Output

School Name is : Govt School
Priya  teacher is teaching 
name : Priya  age 25 employeeId: emp01 subject: Maths
name : hari age 45 employeeId: emp05 years of experience:20 is leading the school with 20 of Experience
name : hari age 45 employeeId: emp05 years of experience:20

🛠️ Technologies Used

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

About

his Java-based School Management System demonstrates core OOP concepts like inheritance, encapsulation, upcasting, and downcasting. It models real-world roles such as Staff, Teacher, and Principal with shared and specific behaviors. Static variables, methods, and blocks are used to manage common resources like the school name.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages