code and setup

This commit is contained in:
2026-05-02 17:53:39 +03:30
parent 9cee42eb50
commit 500afde0c8
10 changed files with 673 additions and 56 deletions
+125
View File
@@ -0,0 +1,125 @@
# 🧙‍♂️ Workshop: Hogwarts School System - A Magical OOP Adventure
## Welcome, Young Wizard!
> *"The sorting hat has placed you in Gryffindor... No, wait! It placed you in the **Java Development** house!"*
Welcome to the **Hogwarts School System** workshop! This magical journey will help you master the fundamentals of **Object-Oriented Programming (OOP)** through a fun, wizard-themed project.
---
## 🎯 Workshop Objectives
By completing this workshop, you will learn and practice:
| Concept | How it's used in this project |
|---------|-------------------------------|
| **Encapsulation** | Private fields with public getters/setters |
| **Inheritance** | `Student` and `Teacher` extend `User` |
| **Polymorphism** | Different user types with same methods |
| **Abstraction** | Abstract `User` class with common behavior |
| **Lists & Collections** | Managing students, teachers, and courses with `ArrayList` |
| **Input Validation** | Validating usernames and passwords |
| **ID-based Selection** | Finding courses by unique ID instead of name |
---
## 🏰 Storyline
*Professor Dumbledore has asked you to help modernize Hogwarts! The old parchment-based course enrollment system is a disaster. Students keep signing up for the wrong classes, and Professor Snape is furious because his Potions class is full of first-year students who can't tell a bezoar from a newt's eye.*
*Your mission: Build a digital School Management System that allows:*
- *Students to view available courses and enroll using magical Course IDs*
- *Teachers to create new courses and manage their classes*
- *Everyone to log in securely (even Filch needs to check who's where)*
---
## 📚 Class Hierarchy Diagram
┌─────────────────┐
│ User │
│ (Abstract) │
└────────┬────────┘
┌──────────────┴──────────────┐
│ │
┌─────▼─────┐ ┌─────▼─────┐
│ Student │ │ Teacher │
└─────┬─────┘ └─────┬─────┘
│ │
┌─────▼─────┐ ┌─────▼─────┐
│enrolled │ │ myCourses │
│ Courses │ │ (List) │
└───────────┘ └───────────┘
┌─────────────────┐
│ Course │
├─────────────────┤
│ - id (static) │
│ - name │
│ - teacher │
│ - students │
└─────────────────┘
│ contains
┌─────────────────┐
│ SchoolSystem │
│ (Service) │
└─────────────────┘
---
---
## 📋 Complete TODO List
### 🔧 Student.java (3 TODOs)
| # | Method | Description |
|---|--------|-------------|
| 1 | `enrollInCourse(Course course)` | Register student in a course |
| 2 | `showMyCourses()` | Display all enrolled courses |
| 3 | `getEnrolledCourses()` | Return list of enrolled courses |
### 🔧 SchoolSystem.java (5 TODOs)
| # | Method | Description |
|---|--------|-------------|
| 4 | `registerStudent(String username, String password)` | Register new student |
| 5 | `loginStudent(String username, String password)` | Student login |
| 6 | `findStudent(String username)` | Find student by username (private) |
| 7 | `addCourseToSystem(String courseName)` | Add new course to system |
| 8 | `findCourseById(int id)` | Find course by ID |
### 🔧 Main.java (4 TODOs)
| # | Location | Description |
|---|----------|-------------|
| 9 | `registerMenu()` - case 1 | Student registration |
| 10 | `loginMenu()` - case 1 | Student login |
| 11 | `studentMenu()` - case 3 | Show my courses |
| 12 | `enrollInCourse(Student student)` | Enroll logic |
### 📊 Summary
| File | TODO Count |
|------|------------|
| Student.java | 3 |
| SchoolSystem.java | 5 |
| Main.java | 4 |
| **Total** | **12** |
---
## ️ Note
> This exercise is for practice only and has no bouns.
> Students can complete it in class with TA assistance.
**Good luck, young wizard!**