{"status":200,"data":{"totalDocs":2836,"limit":10,"hasPrevPage":false,"hasNextPage":true,"page":1,"totalPages":284,"pagingCounter":1,"prevPage":null,"nextPage":2,"docs":[{"languages":["Arduino"],"labels":[],"favourites":[],"slug":"pot-ile-servo-kontrol","_id":"6a2d45c1e8d3fd74cf9b58ca","code":"#include <Servo.h> // Servo kütüphanesini dahil ediyoruz\n\nServo myservo;  // Servo motorumuzu tanımlıyoruz\n\nint potPin = A0;  // Potansiyometrenin bağlı olduğu analog pin\nint potDeger;     // Potansiyometreden okunacak ham değer\nint aci;          // Servoya gönderilecek açı değeri (0-180)\n\nvoid setup() {\n  myservo.attach(9);  // Servo motorun sinyal pinini 9. pine bağlıyoruz\n}\n\nvoid loop() {\n  potDeger = analogRead(potPin);            // Potansiyometreden değeri oku (0-1023 arası)\n  aci = map(potDeger, 0, 1023, 0, 180);     // 0-1023 arası değeri, 0-180 dereceye oranla\n  myservo.write(aci);                       // Hesaplanan açıyı servo motora gönder\n  delay(15);                                // Motorun pozisyon alması için kısa bir süre bekle\n}","description":"Servo","isPrivate":false,"title":"Pot ile Servo Kontrol","addedBy":{"following":[],"followers":[],"favorites":[],"_id":"6a2d4587e8d3fd74cf9b58c1","__v":0,"email":"osmanimel@gmail.com","image":"https://lh3.googleusercontent.com/a/ACg8ocKC4WctdOkxm7Eklmg5zATCCpBNmaPDrFQJLazg6qM0JOyB2I4e=s96-c","name":"osman imel","proUser":true},"favouriteCount":0},{"languages":["Bash"],"labels":[],"favourites":[],"slug":"disk-usage-monitor-sh","_id":"6a2be990e8d3fd74cf9b57c6","code":"#!/usr/bin/env bash\n# disk-usage-monitor.sh\n# Logs disk usage of defined mountpoints as structured JSON to journald.\n# Intended to be run via systemd service + timer.\n\nset -euo pipefail\n\n# ----------------------------------------------------------------------------\n# Configuration\n# ----------------------------------------------------------------------------\n\n# Mountpoints that MUST exist — absence is logged as an error.\nMOUNTPOINTS=(\n    \"/\"\n    \"/boot\"\n)\n\n# Identifier used in log output for filtering in Graylog/fluent-bit.\nLOG_TAG=\"disk-usage-monitor\"\n\nSCRIPT_VERSION=\"1.0.0\"\n\n# One UUID per script run — links all log entries of this run in Graylog.\nRUN_ID=$(cat /proc/sys/kernel/random/uuid)\n\nHOSTNAME=$(hostname -f)\n\n# ----------------------------------------------------------------------------\n# Logging\n# ----------------------------------------------------------------------------\n\n# Derives own_severity from used_percent (integer).\nseverity_from_percent() {\n    local pct=\"$1\"\n    if   [ \"$pct\" -ge 90 ]; then echo \"critical\"\n    elif [ \"$pct\" -ge 80 ]; then echo \"high\"\n    elif [ \"$pct\" -ge 70 ]; then echo \"medium\"\n    else                         echo \"low\"\n    fi\n}\n\n# Emits a structured JSON log line to journald.\n# Usage: emit <systemd_priority> <own_severity> <own_event_group> <message> <extra_json_fields>\n# extra_json_fields: comma-prefixed key-value pairs, e.g. ',\"mountpoint\":\"/var\",\"used_percent\":82'\nemit() {\n    local priority=\"$1\"\n    local severity=\"$2\"\n    local event_group=\"$3\"\n    local message=\"$4\"\n    local extra=\"${5:-}\"\n\n    local timestamp\n    timestamp=$(date -u +\"%Y-%m-%dT%H:%M:%SZ\")\n\n    local json\n    json=$(printf \\\n        '{\"tag\":\"%s\",\"timestamp\":\"%s\",\"host\":\"%s\",\"run_id\":\"%s\",\"script_version\":\"%s\",\"own_policy\":\"compliant\",\"own_category\":\"storage\",\"own_log_level\":\"operational\",\"own_severity\":\"%s\",\"own_event_group\":\"%s\",\"message\":\"%s\"%s}' \\\n        \"$LOG_TAG\"        \\\n        \"$timestamp\"      \\\n        \"$HOSTNAME\"       \\\n        \"$RUN_ID\"         \\\n        \"$SCRIPT_VERSION\" \\\n        \"$severity\"       \\\n        \"$event_group\"    \\\n        \"$message\"        \\\n        \"$extra\")\n\n    echo \"$json\" | systemd-cat -t \"$LOG_TAG\" -p \"$priority\"\n}\n\n# ----------------------------------------------------------------------------\n# Helpers\n# ----------------------------------------------------------------------------\n\nis_mounted() {\n    local mp=\"$1\"\n    mountpoint -q \"$mp\"\n}\n\ncollect_and_log() {\n    local mp=\"$1\"\n\n    local df_output\n    if ! df_output=$(df -P -B1 \"$mp\" 2>/dev/null | tail -n 1); then\n        emit \"err\" \"critical\" \"df_error\" \\\n            \"df failed for mountpoint $mp\" \\\n            \",\\\"mountpoint\\\":\\\"$mp\\\"\"\n        return 1\n    fi\n\n    local filesystem size_bytes used_bytes free_bytes used_percent\n    filesystem=$(  echo \"$df_output\" | awk '{print $1}')\n    size_bytes=$(  echo \"$df_output\" | awk '{print $2}')\n    used_bytes=$(  echo \"$df_output\" | awk '{print $3}')\n    free_bytes=$(  echo \"$df_output\" | awk '{print $4}')\n    used_percent=$(echo \"$df_output\" | awk '{print $5}' | tr -d '%')\n\n    local fstype\n    fstype=$(findmnt -n -o FSTYPE \"$mp\" 2>/dev/null || echo \"unknown\")\n\n    local severity event_group priority message\n    severity=$(severity_from_percent \"$used_percent\")\n\n    case \"$severity\" in\n        low)\n            event_group=\"disk_usage_ok\"\n            priority=\"info\"\n            message=\"Disk usage on $mp is at ${used_percent}% — within normal range\"\n            ;;\n        medium)\n            event_group=\"disk_usage_warning\"\n            priority=\"info\"\n            message=\"Disk usage on $mp is at ${used_percent}% — approaching threshold\"\n            ;;\n        high)\n            event_group=\"disk_usage_warning\"\n            priority=\"warning\"\n            message=\"Disk usage on $mp is at ${used_percent}% — above 80%, attention required\"\n            ;;\n        critical)\n            event_group=\"disk_usage_critical\"\n            priority=\"err\"\n            message=\"Disk usage on $mp is at ${used_percent}% — above 90%, immediate action required\"\n            ;;\n    esac\n\n    local extra\n    extra=$(printf \\\n        ',\"mountpoint\":\"%s\",\"filesystem\":\"%s\",\"fstype\":\"%s\",\"size_bytes\":%s,\"used_bytes\":%s,\"free_bytes\":%s,\"used_percent\":%s' \\\n        \"$mp\"          \\\n        \"$filesystem\"  \\\n        \"$fstype\"      \\\n        \"$size_bytes\"  \\\n        \"$used_bytes\"  \\\n        \"$free_bytes\"  \\\n        \"$used_percent\")\n\n    emit \"$priority\" \"$severity\" \"$event_group\" \"$message\" \"$extra\"\n}\n\n# ----------------------------------------------------------------------------\n# Main\n# ----------------------------------------------------------------------------\n\n# Required mountpoints — absence is logged as an error.\nfor mp in \"${MOUNTPOINTS[@]}\"; do\n    if is_mounted \"$mp\"; then\n        collect_and_log \"$mp\"\n    else\n        emit \"warning\" \"high\" \"mount_point_missing\" \\\n            \"Expected mountpoint $mp is not mounted\" \\\n            \",\\\"mountpoint\\\":\\\"$mp\\\"\"\n    fi\ndone\n\n# Optional mountpoints — silently skipped if not mounted.\n# Covers servers where /boot/efi or /var is a separate partition.\nfor mp in \"/boot/efi\" \"/var\"; do\n    if is_mounted \"$mp\"; then\n        collect_and_log \"$mp\"\n    fi\ndone\n\n# Dynamic discovery of SSDs mounted under /mnt.\n# On VMs without an extra disk this block produces no output.\nwhile IFS= read -r submount; do\n    if is_mounted \"$submount\"; then\n        collect_and_log \"$submount\"\n    fi\ndone < <(findmnt -n -o TARGET --list | grep '^/mnt/' | sort)","description":"Logs disk usage of defined mountpoints as structured JSON to journald. Intended to be run via systemd service + timer.","isPrivate":false,"title":"disk-usage-monitor.sh","addedBy":{"following":[],"followers":[],"favorites":[],"_id":"6a2be922e8d3fd74cf9b57b9","__v":0,"email":"heavy.phoenix23@gmail.com","image":"https://lh3.googleusercontent.com/a/ACg8ocIWDPaVd1N_KcmyKJY-nl8PLeCJLjKNl81YfZz09jYnAFdT9g=s96-c","name":"Andreas Kpunkt","proUser":true},"favouriteCount":0},{"languages":["Employee"],"labels":[],"favourites":[],"slug":"employee","_id":"6a2ad76ae8d3fd74cf9b56e5","code":"import 'package:flutter/material.dart';\nimport 'package:get/get.dart';\nimport '../../controllers/auth_controller.dart';\nimport '../../services/cloudinary_service.dart';\nimport '../../utils/responsive_utils.dart';\nimport 'main_scaffold.dart';\n\nclass EmployeeDashboard extends StatefulWidget {\n  final String userName;\n  final String? email;\n  final bool isCheckedIn;\n  final String attendanceStatus;\n\n  const EmployeeDashboard({\n    super.key,\n    this.userName = 'Employee',\n    this.email,\n    this.isCheckedIn = false,\n    this.attendanceStatus = 'Absent',\n  });\n\n  @override\n  State<EmployeeDashboard> createState() => _EmployeeDashboardState();\n}\n\nclass _EmployeeDashboardState extends State<EmployeeDashboard>\n    with WidgetsBindingObserver {\n  @override\n  void initState() {\n    super.initState();\n    WidgetsBinding.instance.addObserver(this);\n    // Auto-refresh profile picture when dashboard is built\n    WidgetsBinding.instance.addPostFrameCallback((_) {\n      _refreshProfile();\n    });\n  }\n\n  @override\n  void didChangeDependencies() {\n    super.didChangeDependencies();\n    // Register route observer to detect when screen becomes visible\n    final route = ModalRoute.of(context);\n    if (route is PageRoute) {\n      // Refresh when screen becomes visible\n      WidgetsBinding.instance.addPostFrameCallback((_) {\n        _refreshProfile();\n      });\n    }\n  }\n\n  @override\n  void dispose() {\n    WidgetsBinding.instance.removeObserver(this);\n    super.dispose();\n  }\n\n  @override\n  void didChangeAppLifecycleState(AppLifecycleState state) {\n    // Refresh when app comes back to foreground\n    if (state == AppLifecycleState.resumed) {\n      _refreshProfile();\n    }\n  }\n\n  void _refreshProfile() {\n    // Auto-refresh profile picture from Laravel\n    final authController = Get.find<AuthController>();\n    authController.refreshUserModel();\n  }\n\n  @override\n  Widget build(BuildContext context) {\n    final theme = Theme.of(context);\n    return Scaffold(\n      backgroundColor: theme.colorScheme.surface,\n      body: ResponsiveBuilder(\n        builder: (context, isMobile, isTablet, isDesktop) {\n          return SingleChildScrollView(\n            padding: ResponsiveUtils.getScreenPadding(context),\n            child: Column(\n              crossAxisAlignment: CrossAxisAlignment.start,\n              children: [\n                // Welcome Card\n                Obx(() {\n                  final userModel = Get.find<AuthController>().userModel.value;\n                  final name = userModel?.displayName ?? 'profile'.tr;\n                  final email = userModel?.email;\n                  final photoUrl = userModel?.photoUrl;\n\n                  // Generate a unique key based on photoUrl to force rebuild when it changes\n                  final avatarKey = ValueKey(photoUrl ?? 'no-photo');\n\n                  return Card(\n                    elevation: 4,\n                    shape: RoundedRectangleBorder(\n                      borderRadius:\n                          ResponsiveUtils.getCardBorderRadius(context),\n                    ),\n                    child: Padding(\n                      padding:\n                          ResponsiveUtils.getCardPaddingEdgeInsets(context),\n                      child: Row(\n                        children: [\n                          CircleAvatar(\n                            key:\n                                avatarKey, // Force rebuild when photoUrl changes\n                            radius: ResponsiveUtils.isMobile(context) ? 28 : 35,\n                            backgroundColor:\n                                theme.primaryColor.withOpacity(0.1),\n                            backgroundImage: (photoUrl != null &&\n                                    photoUrl.isNotEmpty &&\n                                    photoUrl.contains('cloudinary.com'))\n                                ? NetworkImage(\n                                    CloudinaryService.getOptimizedProfileUrl(\n                                        photoUrl,\n                                        useCacheBusting:\n                                            true), // Enable cache busting\n                                    headers: {\n                                      'Cache-Control': 'no-cache',\n                                    },\n                                  ) as ImageProvider\n                                : null,\n                            child: (photoUrl == null ||\n                                    photoUrl.isEmpty ||\n                                    !photoUrl.contains('cloudinary.com'))\n                                ? Icon(Icons.person,\n                                    size: ResponsiveUtils.getIconSize(context),\n                                    color: theme.primaryColor)\n                                : null,\n                          ),\n                          SizedBox(width: ResponsiveUtils.getSpacing(context)),\n                          Expanded(\n                            child: Column(\n                              crossAxisAlignment: CrossAxisAlignment.start,\n                              children: [\n                                Text(\n                                  'welcome_back'.tr,\n                                  style: TextStyle(\n                                    fontSize: ResponsiveUtils.getBodyFontSize(\n                                        context),\n                                    color: theme.brightness == Brightness.dark\n                                        ? theme.colorScheme.onSurface\n                                            .withOpacity(0.7)\n                                        : Colors.grey[600],\n                                  ),\n                                ),\n                                const SizedBox(height: 4),\n                                Text(\n                                  name,\n                                  style: TextStyle(\n                                    fontSize: ResponsiveUtils.getTitleFontSize(\n                                        context),\n                                    fontWeight: FontWeight.bold,\n                                    color: theme.brightness == Brightness.dark\n                                        ? theme.colorScheme.onSurface\n                                        : theme.primaryColor,\n                                  ),\n                                ),\n                                if (email != null) ...[\n                                  const SizedBox(height: 4),\n                                  Text(\n                                    email,\n                                    style: TextStyle(\n                                      fontSize: ResponsiveUtils.getBodyFontSize(\n                                              context) -\n                                          2,\n                                      color: theme.brightness == Brightness.dark\n                                          ? theme.colorScheme.onSurface\n                                              .withOpacity(0.6)\n                                          : Colors.grey[500],\n                                    ),\n                                  ),\n                                ],\n                              ],\n                            ),\n                          ),\n                        ],\n                      ),\n                    ),\n                  );\n                }),\n\n                SizedBox(height: ResponsiveUtils.getLargeSpacing(context)),\n\n                // Quick Actions Section\n                Text(\n                  'quick_actions'.tr,\n                  style: TextStyle(\n                    fontSize: ResponsiveUtils.getTitleFontSize(context),\n                    fontWeight: FontWeight.bold,\n                    color: theme.primaryColor,\n                  ),\n                ),\n                SizedBox(height: ResponsiveUtils.getSpacing(context)),\n\n                // Quick Actions Grid\n                ResponsiveBuilder(\n                  builder: (context, isMobile, isTablet, isDesktop) {\n                    return Column(\n                      children: [\n                        Row(\n                          children: [\n                            Expanded(\n                              child: _QuickActionCard(\n                                icon: Icons.face,\n                                label: 'selfie_attendance'.tr,\n                                color: Colors.blue,\n                                onTap: () {\n                                  Get.toNamed('/selfie-attendance');\n                                },\n                              ),\n                            ),\n                            SizedBox(\n                                width: ResponsiveUtils.getSpacing(context)),\n                            Expanded(\n                              child: _QuickActionCard(\n                                icon: Icons.history,\n                                label: 'attendance'.tr,\n                                color: Colors.green,\n                                onTap: () {\n                                  Get.find<MainScaffoldController>()\n                                      .changeTab(1);\n                                },\n                              ),\n                            ),\n                          ],\n                        ),\n                        SizedBox(height: ResponsiveUtils.getSpacing(context)),\n                        Row(\n                          children: [\n                            Expanded(\n                              child: _QuickActionCard(\n                                icon: Icons.beach_access,\n                                label: 'leave'.tr,\n                                color: Colors.orange,\n                                onTap: () {\n                                  Get.find<MainScaffoldController>()\n                                      .changeTab(2);\n                                },\n                              ),\n                            ),\n                            SizedBox(\n                                width: ResponsiveUtils.getSpacing(context)),\n                            Expanded(\n                              child: _QuickActionCard(\n                                icon: Icons.attach_money,\n                                label: 'payroll'.tr,\n                                color: Colors.purple,\n                                onTap: () {\n                                  Get.find<MainScaffoldController>()\n                                      .changeTab(3);\n                                },\n                              ),\n                            ),\n                          ],\n                        ),\n                        SizedBox(height: ResponsiveUtils.getSpacing(context)),\n                        Row(\n                          children: [\n                            Expanded(\n                              child: _QuickActionCard(\n                                icon: Icons.person,\n                                label: 'profile'.tr,\n                                color: Colors.teal,\n                                onTap: () async {\n                                  // Navigate to profile and wait for result\n                                  final result = await Get.toNamed('/profile');\n                                  // If profile was updated, refresh user model\n                                  if (result == 'profile_updated') {\n                                    final authController =\n                                        Get.find<AuthController>();\n                                    await authController.refreshUserModel();\n                                  }\n                                },\n                              ),\n                            ),\n                            SizedBox(\n                                width: ResponsiveUtils.getSpacing(context)),\n                            Expanded(\n                              child: _QuickActionCard(\n                                icon: Icons.schedule,\n                                label: 'shift'.tr,\n                                color: Colors.indigo,\n                                onTap: () {\n                                  Get.toNamed('/shift');\n                                },\n                              ),\n                            ),\n                          ],\n                        ),\n                        SizedBox(height: ResponsiveUtils.getSpacing(context)),\n                        Row(\n                          children: [\n                            Expanded(\n                              child: _QuickActionCard(\n                                icon: Icons.people_outline,\n                                label: 'on_leave_team'.tr,\n                                color: Colors.red,\n                                onTap: () {\n                                  Get.toNamed('/team-on-leave');\n                                },\n                              ),\n                            ),\n                            SizedBox(\n                                width: ResponsiveUtils.getSpacing(context)),\n                            Expanded(\n                              child: _QuickActionCard(\n                                icon: Icons.celebration,\n                                label: 'public_holidays'.tr,\n                                color: Colors.orange,\n                                onTap: () {\n                                  Get.toNamed('/public-holidays');\n                                },\n                              ),\n                            ),\n                          ],\n                        ),\n                      ],\n                    );\n                  },\n                ),\n\n                SizedBox(height: ResponsiveUtils.getLargeSpacing(context)),\n\n                // Test Notification Button removed - notifications working normally\n              ],\n            ),\n          );\n        },\n      ),\n    );\n  }\n}\n\nclass _QuickActionCard extends StatelessWidget {\n  final IconData icon;\n  final String label;\n  final Color color;\n  final VoidCallback onTap;\n\n  const _QuickActionCard({\n    required this.icon,\n    required this.label,\n    required this.color,\n    required this.onTap,\n  });\n\n  @override\n  Widget build(BuildContext context) {\n    return GestureDetector(\n      onTap: onTap,\n      child: Card(\n        elevation: 3,\n        shape: RoundedRectangleBorder(\n          borderRadius: ResponsiveUtils.getCardBorderRadius(context),\n        ),\n        child: Padding(\n          padding: EdgeInsets.symmetric(\n            vertical: ResponsiveUtils.getSpacing(context),\n          ),\n          child: Column(\n            mainAxisSize: MainAxisSize.min,\n            children: [\n              Icon(\n                icon,\n                color: color,\n                size: ResponsiveUtils.getIconSize(context),\n              ),\n              SizedBox(height: ResponsiveUtils.getSmallSpacing(context)),\n              Text(\n                label,\n                style: TextStyle(\n                  fontWeight: FontWeight.w600,\n                  color: color,\n                  fontSize: ResponsiveUtils.getBodyFontSize(context),\n                ),\n              ),\n            ],\n          ),\n        ),\n      ),\n    );\n  }\n}\n","description":"wesee","isPrivate":false,"title":"Employee","addedBy":{"following":[],"followers":[],"favorites":[],"_id":"6a2ad21ce8d3fd74cf9b56c7","__v":0,"email":"txun.annex2024@gmail.com","image":"https://lh3.googleusercontent.com/a/ACg8ocJwEXZEv8B8E8HphcOnK62xGrzUcCTyQ41DyKG9LvAIWbARsQ=s96-c","name":"Txun 7777","proUser":true},"favouriteCount":0},{"languages":["C"],"labels":[],"favourites":[],"slug":"ejercicio1_tallerprogramacion03-06-2926","_id":"6a29acd9e8d3fd74cf9b558f","code":"#include <stdio.h>    // Inclusión de la librería estándar para entrada y salida de datos (como printf).\n#include <stdbool.h>  // Inclusión de la librería que permite usar el tipo de dato booleano (true/false).\n#include <stdlib.h>   // Inclusión de la librería estándar que contiene las funciones rand() y srand().\n#include <time.h>     // Inclusión de la librería de tiempo para usar time() al inicializar los números aleatorios.\n\n#define MAX 100       // Definición del tamaño máximo del arreglo que guarda el historial de tiradas.\n#define LIM_BI 1      // Límite inferior para la selección del banner (1 representa Banner A).\n#define LIM_BS 2      // Límite superior para la selección del banner (2 representa Banner B).\n#define EST_MAX 5     // Rareza máxima posible de obtener en una tirada (5 estrellas: legendario)[cite: 23].\n#define EST_MIN 1     // Rareza mínima posible de obtener en una tirada (1 estrella: común)[cite: 22].\n\n// Definición de la estructura para encapsular de forma independiente los datos de cada banner[cite: 25, 30].\ntypedef struct {\n\tint ban[MAX];          // Arreglo (historial) que almacena el resultado de cada tirada realizada en este banner.\n\tint tam;               // Contador del número total de tiradas ejecutadas en este banner específico.\n\tint indice;            // Índice que apunta a la posición libre del arreglo donde se guardará la siguiente tirada.\n\tint cinco_estrellas;   // Contador del número de intentos requeridos hasta conseguir el primer personaje de 5 estrellas[cite: 40].\n\tint pity;              // Contador acumulado de mala suerte (cuenta tiradas consecutivas sin obtener un 5 estrellas)[cite: 26].\n\tbool primer_5;         // Bandera booleana que cambia a true tan pronto como se obtiene el primer 5 estrellas.\n} banner;\n\n// Prototipo de la función recursiva que simula el proceso de invocaciones[cite: 28].\nvoid invocaciones(banner *a, banner *b);\n\n// Prototipo de la función recursiva complementaria que busca si existe un 5 estrellas en el historial.\nint buscarInvo(banner *a, int i);\n\nint main(){\n\t// Inicializa la semilla del generador numérico basándose en la hora actual del sistema para asegurar azar real.\n\tsrand(time(NULL));\n\n\t// Declaración e inicialización en cero de todas las variables miembros de las estructuras para el Banner A y B.\n\tbanner a = {0};\n\tbanner b = {0};\n\t\n\n\t// Llamada inicial a la función recursiva enviando las direcciones de memoria de ambos banners[cite: 28].\n\tinvocaciones(&a, &b);\n\n\t// Impresión en consola de los resultados finales exigidos por el requerimiento del sistema[cite: 34, 38].\n\tprintf(\"Total de tiradas general: %d\\n\", a.tam + b.tam); // Suma el esfuerzo total invertido entre ambos banners[cite: 39].\n\tprintf(\"Total de tiradas para cinco estrellas del banner a: %d\\n\", a.cinco_estrellas); // Intentos hasta el primer 5★ de A[cite: 40].\n\tprintf(\"Total de tiradas para cinco estrellas del banner b: %d\\n\", b.cinco_estrellas); // Intentos hasta el primer 5★ de B[cite: 40].\n\t\n\treturn 0; // Finalización exitosa del programa principal.\n}\n\n// Desarrollo de la función recursiva principal para simular el gacha[cite: 28].\nvoid invocaciones(banner *a, banner *b){\n\t// Selección al azar de un banner utilizando el rango definido: genera el valor 1 o 2[cite: 20, 29].\n\tint elec_banner = LIM_BI + rand() % (LIM_BS - LIM_BI + 1);\n\t// Generación aleatoria inicial del resultado de la tirada: produce un entero entre 1 y 5[cite: 21].\n\tint invocar = EST_MIN + rand() % (EST_MAX - EST_MIN + 1);\n\t\n\t// CASO BASE: Llama a buscarInvo para verificar si AMBOS banners ya consiguieron al menos un 5 estrellas[cite: 31, 32].\n\tif(buscarInvo(a, 0) && buscarInvo(b, 0)){\n\t\treturn; // Detiene la recursividad por completo y regresa de la pila de llamadas hacia el main.\n\t}else{\n\t\t// Mecanismo de desvío seguro: si el azar eligió el Banner A pero este ya cumplió su meta, el tiro va a B.\n\t\tif(elec_banner == 1 && a->primer_5 == true){\n\t\t\telec_banner = 2; // Forzar el procesamiento hacia el Banner B.\n\n\t\t// Si el azar eligió el Banner B pero este ya cumplió su meta, el tiro se desvía a A.\n\t\t}else if(elec_banner == 2 && b->primer_5 == true){\n\t\t\telec_banner = 1; // Forzar el procesamiento hacia el Banner A.\n\t\t}\n\n\t\t// --- SECCIÓN DE PROCESAMIENTO PARA EL BANNER A ---\n\t\tif(elec_banner == 1){\n\t\t\ta->tam = a->tam + 1; // Incrementa el contador total de tiradas ejecutadas en el Banner A.\n\t\t\t\n\t\t\t// Si el Banner A aún no ha obtenido su primer personaje de 5 estrellas...\n\t\t\tif(!a->primer_5){\n\t\t\t\ta->cinco_estrellas++; // Sigue sumando los intentos invertidos hasta conseguir el primero[cite: 40].\n\t\t\t}\n\t\t\t\n\t\t\t// Regala la regla del Pity: si ya ocurrieron 10 fallos consecutivos, el intento 11 se fuerza a 5★[cite: 26].\n\t\t\tif(a->pity == 10){\n\t\t\t\tinvocar = 5; // Modifica el resultado ordinario por el personaje legendario garantizado[cite: 26].\n\t\t\t}\n\t\t\t\n\t\t\ta->ban[a->indice] = invocar; // Almacena el resultado final obtenido en la posición actual del historial.\n\t\t\ta->indice++;                 // Avanza el índice del historial a la siguiente casilla disponible.\n\n\t\t\t// Evalúa el resultado de la tirada consolidada.\n\t\t\tif(invocar == 5){\n\t\t\t\ta->primer_5 = true; // Activa la bandera permanente: se alcanzó el objetivo del banner[cite: 31].\n\t\t\t\ta->pity  = 0;       // El pity cumplió su función y se reinicia exitosamente a cero[cite: 26].\n\t\t\t}else{\n\t\t\t\ta->pity++;          // Incrementa el acumulador de mala suerte debido a un personaje común (1-4)[cite: 22, 26].\n\t\t\t}\n\n\t\t// --- SECCIÓN DE PROCESAMIENTO PARA EL BANNER B ---\n\t\t}else{\n\t\t\tb->tam = b->tam + 1; // Incrementa el contador total de tiradas ejecutadas en el Banner B.\n\t\t\t\n\t\t\t// Si el Banner B aún no ha obtenido su primer personaje de 5 estrellas...\n\t\t\tif(!b->primer_5){\n\t\t\t\tb->cinco_estrellas++; // Sigue sumando los intentos invertidos hasta conseguir el primero[cite: 40].\n\t\t\t}\n\t\t\t\n\t\t\t// Regala la regla del Pity para el Banner B: al décimo fallo, la tirada 11 es 5★ garantizado[cite: 26].\n\t\t\tif(b->pity == 10){\n\t\t\t\tinvocar = 5; // Fuerza el personaje legendario por protección de mala suerte[cite: 26].\n\t\t\t}\n\t\t\t\n\t\t\tb->ban[b->indice] = invocar; // Guarda el resultado en el historial correspondiente del Banner B.\n\t\t\tb->indice++;                 // Incrementa el puntero del índice para el próximo registro de B.\n\n\t\t\t// Evalúa el resultado de la tirada del Banner B.\n\t\t\tif(invocar == 5){\n\t\t\t\tb->primer_5 = true; // Activa la bandera de cumplimiento para el Banner B[cite: 32].\n\t\t\t\tb->pity  = 0;       // Reinicia el contador de rachas negativas a cero[cite: 26].\n\t\t\t}else{\n\t\t\t\tb->pity++;          // Incrementa el acumulador de pity al haber fallado el tiro actual[cite: 26].\n\t\t\t}\n\t\t}\n\t\t\n\t\t// PASO RECURSIVO: Llama nuevamente a la función compartiendo las estructuras modificadas para la siguiente tirada[cite: 29].\n\t\tinvocaciones(a, b);\n\t}\n}\n\n// Desarrollo de la función de búsqueda recursiva horizontal dentro del historial del banner.\nint buscarInvo(banner *a, int i){\n\t\n\t// Condición de éxito: Si en la posición actual del arreglo encontramos guardado un 5, retorna verdadero (1).\n\tif(a->ban[i] == 5){\n\t\treturn 1; // Informa inmediatamente a la aplicación que el banner ya posee un personaje legendario.\n\t}else{\n\t\t// Condición de salida por fracaso: Si el índice en revisión iguala o supera las tiradas reales efectuadas...\n\t\tif(i >= a->tam){\n\t\t\treturn 0; // Informa que se escaneó todo el registro existente y no se halló ningún 5 estrellas.\n\t\t}\n\t}\n\n\t// PASO RECURSIVO HORIZONTAL: Incrementa el índice (i + 1) para evaluar la siguiente casilla consecutiva del arreglo.\n\treturn buscarInvo(a, i + 1);\n}\n","description":"Ejercicio sobre dos banners de genshin impact que utiliza recursion y centinelas aleatorios para simular un sistema de gacha","isPrivate":false,"title":"Ejercicio1_tallerProgramacion03/06/2926","addedBy":{"following":[],"followers":[],"favorites":[],"_id":"6a29ac1be8d3fd74cf9b5586","__v":0,"email":"gjot05082001@gmail.com","image":"https://lh3.googleusercontent.com/a/ACg8ocIuFvkkLSmi5E8rkLVpJX74dtIyVzN4vtyTgUUi_29UQ88WK6s=s96-c","name":"Gabriel Jose Osio Tapia","proUser":true},"favouriteCount":0},{"languages":["C++"],"labels":[],"favourites":[],"slug":"hello-7","_id":"6a292be9e8d3fd74cf9b5535","code":"#include <Servo.h>\n\nconst int TRIG_PIN = 6; \nconst int ECHO_PIN = 7; \nconst int SERVO_PIN = 9; \nconst int DISTANCE_THRESHOLD = 50; // Trigger distance in cm\n\n// Angle configuration\nconst int MEAN_POSITION = 90;       // Center starting point\nconst int TRAVEL_ANGLE = 40;        // How far to swing from center\n\nServo lightSwitchServo;\nfloat duration, distance;\n\nbool lightState = false;       // false = OFF, true = ON\nbool objectPresent = false;    // Tracks if a person is in front of the sensor\n\nvoid setup() {\n  Serial.begin(9600);\n  pinMode(TRIG_PIN, OUTPUT);\n  pinMode(ECHO_PIN, INPUT);\n  lightSwitchServo.attach(SERVO_PIN);\n  \n  // Go straight to the mean position at startup\n  lightSwitchServo.write(MEAN_POSITION); \n}\n\nvoid loop() {\n  // Measure distance from the sensor\n  digitalWrite(TRIG_PIN, LOW);\n  delayMicroseconds(2);\n  digitalWrite(TRIG_PIN, HIGH);\n  delayMicroseconds(10);\n  digitalWrite(TRIG_PIN, LOW);\n\n  duration = pulseIn(ECHO_PIN, HIGH);\n  distance = duration * 0.01715;\n\n  if (distance > 0 && distance < DISTANCE_THRESHOLD) {\n    // Execute only once per trigger event\n    if (!objectPresent) { \n      objectPresent = true; \n      \n      if (!lightState) {\n        // Swing Clockwise (+40 degrees)\n        Serial.println(\"Action: Turning ON (90 -> 130 -> 90)\");\n        lightSwitchServo.write(MEAN_POSITION + TRAVEL_ANGLE); \n        delay(400); // Wait for the flick to complete\n        \n        // Return immediately to center\n        lightSwitchServo.write(MEAN_POSITION); \n        lightState = true;\n      } else {\n        // Swing Counter-Clockwise (-40 degrees)\n        Serial.println(\"Action: Turning OFF (90 -> 50 -> 90)\");\n        lightSwitchServo.write(MEAN_POSITION - TRAVEL_ANGLE); \n        delay(400); // Wait for the flick to complete\n        \n        // Return immediately to center\n        lightSwitchServo.write(MEAN_POSITION); \n        lightState = false;\n      }\n      \n      delay(1000); // Prevent accidental double-triggers\n    }\n  } else {\n    // Reset trigger block when object moves away\n    objectPresent = false; \n  }\n  \n  delay(100); \n}\n","description":"Hello","isPrivate":false,"title":"Hello","addedBy":{"following":[],"followers":[],"favorites":[],"_id":"6a292b79e8d3fd74cf9b552c","__v":0,"email":"dwijrajsinh12132@gmail.com","image":"https://lh3.googleusercontent.com/a/ACg8ocLVEjz46roZAQE12Jx0TuhJ5S-AwMHaDoEtdgByDOk-XLFUIw=s96-c","name":"Dwijrajsinh Gohil","proUser":true},"favouriteCount":0},{"languages":["Python"],"labels":[],"favourites":[],"slug":"formula-principal-do-projeto","_id":"6a28d059e8d3fd74cf9b54e2","code":"def calcular_ira(fd, fc, ft, fco, fh):\n    soma = fd + fc + ft + fco + fh\n    ira = (soma / 130) * 100\n    return soma, round(ira, 2)\n","description":"Implementação da fórmula do IRA. Função responsável por calcular o Índice de Risco de Acúmulo a partir dos fatores coletados.","isPrivate":false,"title":"FORMULA PRINCIPAL DO PROJETO ","addedBy":{"following":[],"followers":[],"favorites":[],"_id":"6a28cfbee8d3fd74cf9b54d1","__v":0,"email":"juansilvarb16@gmail.com","image":"https://lh3.googleusercontent.com/a/ACg8ocLhvOEeeTk_1CY_zJ8pb7DYc5KdxZ3R4Aons9W9NjnHtOqpYqOB=s96-c","name":"Juan Silva Ribeiro","proUser":true},"favouriteCount":0},{"languages":["Python"],"labels":[],"favourites":[],"slug":"connect-4","_id":"6a2822b6e8d3fd74cf9b5489","code":"# Sabeeha Rehman\n# Jun/9/2026\n# Pygame CONMECT 4\n\nimport pygame\n\n# Initialize pygame\npygame.init()\n\n# Colors\nblue = (5, 160, 237)\nblack = (0, 0, 0)\nred = (235, 45, 45)\nyellow = (252, 234, 68)\nwhite = (255, 255, 255)\ngray = (200, 200, 200)\n\n# Board settings\nrows = 6\ncolumns = 7\nsqSize = 100\nrad = int(sqSize / 2 - 5)\n\n# Screen size\nwidth = columns * sqSize\nheight = (rows + 1) * sqSize\nsize = (width, height)\n\nscreen = pygame.display.set_mode(size)\npygame.display.set_caption(\"Connect 4\")\n\n# Fonts\ntitle_font = pygame.font.SysFont(\"Arial\", 70)\nbutton_font = pygame.font.SysFont(\"Arial\", 40)\ngame_font = pygame.font.SysFont(\"Arial\", 50)\n\n# Create board\nboard = []\n\nfor row in range(rows):\n    board.append([0] * columns)\n\n# Draw board\ndef draw_board():\n\n    for c in range(columns):\n        for r in range(rows):\n\n            pygame.draw.rect(screen,blue,(c * sqSize,r * sqSize + sqSize,sqSize,sqSize))\n\n            color = white\n\n            if board[r][c] == 1:\n                color = red\n            elif board[r][c] == 2:\n                color = yellow\n\n            pygame.draw.circle(screen,color,(c * sqSize + sqSize // 2,r * sqSize + sqSize + sqSize // 2),rad)\n\n# Drop piece\ndef drop_piece(col, piece):\n\n    for r in range(rows - 1, - 1, - 1):\n        if board[r][col] == 0:\n            board[r][col] = piece\n            return True\n\n    return False\n\n# Check winner\ndef check_win(piece):\n\n    # Horizontal\n    for r in range(rows):\n        for c in range(columns - 3):\n\n            if (board[r][c] == piece and board[r][c + 1] == piece and board[r][c + 2] == piece and board[r][c + 3] == piece):\n                return True\n\n    # Vertical\n    for c in range(columns):\n        for r in range(rows - 3):\n\n            if (board[r][c] == piece and board[r + 1][c] == piece and board[r + 2][c] == piece and board[r + 3][c] == piece):\n                return True\n\n    # Diagonal down-right\n    for r in range(rows - 3):\n        for c in range(columns - 3):\n\n            if (board[r][c] == piece and board[r + 1][c + 1] == piece and board[r + 2][c + 2] == piece and board[r + 3][c + 3] == piece):\n                return True\n\n    # Diagonal up-right\n    for r in range(3, rows):\n        for c in range(columns - 3):\n\n            if (board[r][c] == piece and board[r - 1][c + 1] == piece and board[r - 2][c + 2] == piece and board[r - 3][c + 3] == piece):\n                return True\n    return False\n\n# Home screen\ndef home_screen():\n\n    while True:\n\n        screen.fill((20, 20, 40))\n\n        # Animated title colors\n        title_color = (pygame.time.get_ticks() % 255,100,255)\n\n        # Main title\n        title = title_font.render(\"CONNECT 4\", True, title_color)\n        screen.blit(title, (160, 120))\n\n        # Subtitle\n        subtitle_font = pygame.font.SysFont(\"Arial\", 30)\n\n        subtitle = subtitle_font.render(\"Drop 4 pieces in a row to win!\",True,white)\n\n        screen.blit(subtitle, (170, 220))\n\n        # Decorative circles\n        pygame.draw.circle(screen, red, (150, 400), 40)\n        pygame.draw.circle(screen, yellow, (550, 400), 40)\n\n        pygame.draw.circle(screen, red, (250, 500), 40)\n        pygame.draw.circle(screen, yellow, (450, 500), 40)\n\n        # Start button\n        button_rect = pygame.Rect(225, 300, 250, 80)\n\n        pygame.draw.rect(screen, blue, button_rect, border_radius=15)\n\n        button_text = button_font.render(\"START GAME\", True, white)\n        screen.blit(button_text, (245, 320))\n\n        # Instructions\n        instructions = subtitle_font.render(\"Click anywhere on a column to place a piece\",True,gray)\n\n        screen.blit(instructions, (90, 620))\n\n        pygame.display.update()\n\n        for event in pygame.event.get():\n\n            # Quit game\n            if event.type == pygame.QUIT:\n                pygame.quit()\n\n            # Mouse click\n            if event.type == pygame.MOUSEBUTTONDOWN:\n\n                mouse_pos = event.pos\n\n                # Start game if button clicked\n                if button_rect.collidepoint(mouse_pos):\n                    return\n\n# Show home screen\nhome_screen()\n\n# Game variables\nturn = 0\ngame_over = False\n\n# Draw board\ndraw_board()\npygame.display.update()\n\n# Main game loop\nrunning = True\n\nwhile running:\n\n    for event in pygame.event.get():\n\n        # Quit game\n        if event.type == pygame.QUIT:\n            running = False\n\n        # Mouse movement\n        if event.type == pygame.MOUSEMOTION:\n\n            pygame.draw.rect(screen, white, (0, 0, width, sqSize))\n\n            pos_x = event.pos[0]\n\n            # Player 1 preview\n            if turn == 0:\n\n                pygame.draw.circle(screen,red,(pos_x, sqSize // 2),rad)\n\n            # Player 2 preview\n            else:\n\n                pygame.draw.circle(screen,yellow,(pos_x, sqSize // 2),rad)\n\n            pygame.display.update()\n\n        # Mouse click\n        if event.type == pygame.MOUSEBUTTONDOWN and not game_over:\n\n            pygame.draw.rect(screen, white, (0, 0, width, sqSize))\n\n            pos_x = event.pos[0]\n            col = pos_x // sqSize\n\n            # Player 1\n            if turn == 0:\n\n                if drop_piece(col, 1):\n                    if check_win(1):\n                        label = game_font.render(\"Red Wins!\", True, red)\n                        screen.blit(label, (40, 10))\n\n                        game_over = True\n\n                    turn = 1\n\n            # Player 2\n            else:\n\n                if drop_piece(col, 2):\n                    if check_win(2):\n                        label = game_font.render(\"Yellow Wins!\", True, yellow)\n                        screen.blit(label, (40, 10))\n\n                        game_over = True\n\n                    turn = 0\n\n            draw_board()\n            pygame.display.update()\n\n            # Pause before closing\n            if game_over:\n                pygame.time.wait(4000)\n                running = False\n\npygame.quit()","description":"game","isPrivate":false,"title":"Connect 4","addedBy":{"following":[],"followers":[],"favorites":[],"_id":"6a282246e8d3fd74cf9b5472","__v":0,"email":"759478@pdsb.net","image":"https://lh3.googleusercontent.com/a/ACg8ocKko4Pu-8LNgEnH1jUUBt-4jGd30yNCoqvwiTela2WHeFGD13qV=s96-c","name":"SR - 12ZZ 759478 Heart Lake SS","proUser":true},"favouriteCount":0},{"languages":["PHP"],"labels":[],"favourites":[],"slug":"typo3conf-ext-custom_theme-configuration-tca-overrides-tx_news_domain_model_news-php","_id":"6a27bd8ce8d3fd74cf9b5426","code":"<?php\ndefined('TYPO3') or die();\n\n/**\n * Restrict the available content elements for news records using a filter function\n */\n$GLOBALS['TCA']['tx_news_domain_model_news']['columns']['content_elements']['config']['overrideChildTca'] = [\n    'columns' => [\n        'CType' => [\n            'config' => [\n                'itemsProcFunc' => \\Evoq\\CustomTheme\\Backend\\TcaFilter::class . '->filterNewsCTypes',\n            ],\n        ],\n    ],\n];","description":"Call TcaFilter to filter the CType","isPrivate":false,"title":"typo3conf/ext/custom_theme/Configuration/TCA/Overrides/tx_news_domain_model_news.php","addedBy":{"following":[],"followers":[],"favorites":[],"_id":"6a27bcb4e8d3fd74cf9b5412","__v":0,"email":"contact@marcelmarty.ch","image":"https://avatars.githubusercontent.com/u/1627210?v=4","name":"Marcel Marty","proUser":true},"favouriteCount":0},{"languages":["Java"],"labels":[],"favourites":[],"slug":"universitystructures-java","_id":"6a2715f7e8d3fd74cf9b53ff","code":"/*****************************************************************\n * المادة: البرمجة الشيئية (OOP) - مشروع إدارة الجامعة\n * اسم الطالبة: دعاء علي الواعر\n * رقم القيد: 2241807073\n * الملف الرابع: المناهج، الأقسام والجامعة\n *****************************************************************/\nimport java.util.ArrayList;\n\n// كلاس تمثل المادة الدراسية والرمز بتاعها وساعاتها\nclass Course {\n    private String code;\n    private String name;\n    private int hours;\n\n    public Course(String code, String name, int hours) {\n        this.code = code;\n        this.name = name;\n        this.hours = hours;\n    }\n\n    public String getCode() { return code; }\n    public String getName() { return name; }\n    public int getHours() { return hours; }\n\n    // دالة بسيطة باش تطبع سطر تفاصيل المادة بشكل منظم\n    public void displayCourse() {\n        System.out.println(\"    Code: \" + code + \" | Course: \" + name + \" | Hours: \" + hours);\n    }\n}\n\n// كلاس القسم الأكاديمي وفيه لستة المواد اللي تابعة ليه\nclass Department {\n    private String name;\n    private ArrayList<Course> courseList;\n\n    public Department(String name) {\n        this.name = name;\n        this.courseList = new ArrayList<>();\n    }\n\n    public String getName() { return name; }\n    \n    // دالة باش نزيدوا مادة جديدة للقسم هادّا\n    public void addCourse(Course course) {\n        courseList.add(course);\n        System.out.println(\"›› Success: Course '\" + course.getName() + \"' linked to department: \" + name);\n    }\n\n    // دالة تلف وتطبع كل المواد اللي تابعة للقسم\n    public void displayAllCourses() {\n        System.out.println(\"‹‹‹ Department: \" + name + \" Courses ›››\");\n        if (courseList.isEmpty()) {\n            System.out.println(\"    No courses assigned to this department yet.\");\n        } else {\n            for (Course c : courseList) {\n                c.displayCourse();\n            }\n        }\n    }\n}\n\n// كلاس الجامعة ومسؤول على عرض التقرير السنوي المجمع\nclass University {\n    private String name;\n    private String city;\n    private String street;\n\n    public University(String name, String city, String street) {\n        this.name = name;\n        this.city = city;\n        this.street = street;\n    }\n\n    // دالة تاخد الحسبة الإجمالية للناس والمواد وتطبع التقرير السنوي للجامعة\n    public void displayAnnualReport(int totalPeople, int totalCourses) {\n        System.out.println(\"\\n~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\");\n        System.out.println(\"        UNIVERSITY ANNUAL REPORT         \");\n        System.out.println(\"~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\");\n        System.out.println(\"University: \" + name);\n        System.out.println(\"Address:    \" + street + \", \" + city);\n        System.out.println(\"Personnel Counter: [\" + totalPeople + \"] Active Registered Members\");\n        System.out.println(\"Academic Syllabus: [\" + totalCourses + \"] Approved Courses\");\n        System.out.println(\"~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\\n\");\n    }\n}","description":"OOP-Final-Project","isPrivate":false,"title":"UniversityStructures.java","addedBy":{"following":[],"followers":[],"favorites":[],"_id":"6a271355e8d3fd74cf9b53db","__v":0,"email":"doaaelwaer06@gmail.com","image":"https://lh3.googleusercontent.com/a/ACg8ocJ0mrFWE7tMewn8xdqDGo8uJLqe0Zrl8MSH69ea--IOnu35G6g=s96-c","name":"Doaa Elwaer","proUser":true},"favouriteCount":0},{"languages":["Java"],"labels":[],"favourites":[],"slug":"subclasses-java","_id":"6a2715bbe8d3fd74cf9b53fb","code":" /*****************************************************************\n * المادة: البرمجة الشيئية (OOP) - مشروع إدارة الجامعة\n * اسم الطالبة: دعاء علي الواعر\n * رقم القيد: 2241807073\n * الملف الثالث: الفئات الفرعية الموروثة (Inheritance)\n *****************************************************************/ \nimport java.util.ArrayList;\n\n// كلاس الطالب يورث من كلاس الشخص وعنده لستة خاصة بالمواد اللي ينزلها\nclass Student extends Person {\n    private double gpa;\n    private ArrayList<Course> registeredCourses; \n\n    public Student(String id, String name, int age, double gpa) {\n        super(id, name, age); // نبعتوا البيانات الأساسية فوق لكلاس الأب\n        this.gpa = gpa;\n        this.registeredCourses = new ArrayList<>();\n    }\n\n    public double getGpa() { return gpa; }\n    public ArrayList<Course> getRegisteredCourses() { return registeredCourses; }\n\n    // دالة تزيد مادة جديدة في لستة مواد الطالب\n    public void registerCourse(Course course) {\n        this.registeredCourses.add(course);\n    }\n\n    // دالة تلف على المواد وتحسب مجموع الساعات اللي نزلها الطالب\n    public int calculateTotalHours() {\n        int totalHours = 0;\n        for (Course c : registeredCourses) {\n            totalHours += c.getHours();\n        }\n        return totalHours;\n    }\n\n    // نعدلوا دالة العرض باش تطبع تفاصيل الطالب الإضافية (Method Overriding)\n    @Override\n    public void display() {\n        super.display(); // نطبعوا بيانات الأب الأولى قبل\n        System.out.println(\" | [Student] GPA: \" + gpa + \" | Registered Hours: \" + calculateTotalHours());\n    }\n}\n\n// كلاس الدكتور يورث الشخص ويطبق إنترفيس الدفع لحساب مرتب الأكاديميين\nclass Faculty extends Person implements Payable {\n    private String specialization;\n    private double baseSalary;\n\n    public Faculty(String id, String name, int age, String specialization, double baseSalary) {\n        super(id, name, age);\n        this.specialization = specialization;\n        this.baseSalary = baseSalary;\n    }\n\n    // الدكتور ياخد في مرتبه الأساسي الثابت بس\n    @Override\n    public double calculateSalary() {\n        return baseSalary;\n    }\n\n    @Override\n    public void display() {\n        super.display();\n        System.out.println(\" | [Faculty] Specialization: \" + specialization + \" | Fixed Salary: $\" + calculateSalary());\n    }\n}\n\n// كلاس الموظف يورث الشخص ويطبق إنترفيس الدفع ويجمع الراتب مع المكافأة\nclass Staff extends Person implements Payable {\n    private String departmentName;\n    private double baseSalary;\n    private double bonuses;\n\n    public Staff(String id, String name, int age, String departmentName, double baseSalary, double bonuses) {\n        super(id, name, age);\n        this.departmentName = departmentName;\n        this.baseSalary = baseSalary;\n        this.bonuses = bonuses;\n    }\n\n    // الإداري ياخد في المرتب الأساسي ومزيد عليه العلاوات والحوافز\n    @Override\n    public double calculateSalary() {\n        return baseSalary + bonuses;\n    }\n\n    @Override\n    public void display() {\n        super.display();\n        System.out.println(\" | [Staff] Dept: \" + departmentName + \" | Total Salary with Bonuses: $\" + calculateSalary());\n    }\n}","description":"OOP-Final-Project","isPrivate":false,"title":"Subclasses.java","addedBy":{"following":[],"followers":[],"favorites":[],"_id":"6a271355e8d3fd74cf9b53db","__v":0,"email":"doaaelwaer06@gmail.com","image":"https://lh3.googleusercontent.com/a/ACg8ocJ0mrFWE7tMewn8xdqDGo8uJLqe0Zrl8MSH69ea--IOnu35G6g=s96-c","name":"Doaa Elwaer","proUser":true},"favouriteCount":0}]}}