A console-based C++ application for managing police department operations including officers, staff, criminals, cases, and witnesses.
- Overview
- System Architecture
- Features
- Technical Specifications
- Installation and Setup
- Usage
- Known Issues and Limitations
- Future Enhancements
- License
This Police Department Management System is designed to streamline administrative operations within a police department. The system provides functionality to manage personnel records, criminal databases, case files, and witness information through a menu-driven console interface.
The application follows an object-oriented design with the following core classes:
- Central management class coordinating all operations
- Contains vectors of officers, staff, criminals, cases, and witnesses
- Implements CRUD operations for all entities
- Manages data initialization and user interactions
- Encapsulates police officer information
- Attributes: ID, name, position, phone number, NID
- Methods: Display officer details, retrieve officer ID, update position
- Manages criminal records
- Attributes: ID, name, cell number, crime description, punishment duration
- Methods: Display criminal details, retrieve ID and punishment duration
- Declared as friend class to
police_casefor integrated case management
- Handles non-officer personnel data
- Attributes: ID, name, position, phone number, NID
- Methods: Display staff details, retrieve ID and position
- Manages case information and status tracking
- Attributes: Case ID, description, criminal name, case status
- Methods: Display case details, retrieve case ID
- Automatically creates criminal records for solved cases
- Stores witness testimonies
- Attributes: Name, age, statement
- Methods: Display witness information, retrieve age
- Encapsulation: All classes use private data members with public getter/setter methods
- Friend Functions:
promote_officer()andadd_initial_data()have privileged access topolice_systeminternals - Vector-based Storage: Dynamic arrays (STL vectors) for flexible data management
User Input → Main Menu → police_system Methods → Individual Class Operations → Console Output
The system operates in a continuous loop until the user chooses to exit, with password authentication at startup.
-
Information Display
- View all officers, criminals, staff, cases, and witnesses
- Formatted console output for each entity type
-
Search Operations
- Search officers, staff, criminals, and cases by ID
- Search witnesses by age
- Real-time feedback on search results
-
Data Entry
- Add multiple records in batch mode
- Interactive prompts for all required fields
- Automatic criminal record creation for solved cases
-
Record Management
- Remove officers and staff by ID
- Remove criminals with punishment duration validation
- Legal compliance checks for criminal removal
-
Officer Promotion
- Update officer positions
- ID-based promotion system
-
Security
- Password-protected access (default: "tutturu")
- Masked password input using getch()
The system includes sample data for demonstration:
- 3 officers (Commissioner, Deputy Commissioner, Officer-In-Charge)
- 3 criminals with various offenses
- 3 staff members (Food Observer, Floor Cleaner, Security Guard)
- 3 cases (SOLVED, UNSOLVED, ONGOING)
- Language: C++
- Compiler: Code::Blocks (project files included)
- Standard Libraries:
<bits/stdc++.h>(GCC-specific aggregate header)<conio.h>(Windows-specific console I/O)
- GCC/G++ compiler with C++11 or higher
- Windows operating system (due to
conio.hdependency) - Code::Blocks IDE (optional, project files provided)
Assignment of 2107004/
├── main.cpp # Main source code
├── Assignment of 2107004.cbp # Code::Blocks project file
├── Assignment of 2107004.depend # Dependency file
├── Assignment of 2107004.layout # IDE layout configuration
├── bin/
│ └── Debug/ # Debug executable output
└── obj/
└── Debug/ # Object files
- Install a C++ compiler (GCC/MinGW recommended for Windows)
- Install Code::Blocks IDE or use command-line compilation
- Open
Assignment of 2107004.cbpin Code::Blocks - Select Build → Build (or press F9)
- Run the executable from Build → Run
g++ main.cpp -o police_system.exe
police_system.exeg++ main.cpp -o police_system -std=c++11
./police_systemNote: Linux/Mac compilation requires removing conio.h dependency and implementing alternative input methods.
- Run the compiled executable
- Enter your name when prompted
- Enter the password:
tutturu - Navigate through the menu system using numeric options
Main Menu Options:
- Show Information - Display all records of selected entity type
- Search Information - Find specific records by ID or age
- Add Information - Create new records
- Remove Information - Delete existing records
- Promote Officer - Update officer positions
- Quit - Exit the application
1. Select option 1 (Show Information)
2. Choose sub-option 1 (Show Police Information)
3. View all officer records
4. Press 'Y' to continue or 'N' to exit
-
Non-Portable Headers
<bits/stdc++.h>is GCC-specific and increases compilation time<conio.h>limits platform compatibility to Windows- Impact: Cannot compile on Linux/Mac without modifications
-
No Data Persistence
- All data stored in memory (STL vectors)
- Data is lost when the application closes
- Impact: Unsuitable for production use without database integration
-
Security Vulnerabilities
- Password hardcoded in source code
- No encryption or secure authentication
- Impact: Unauthorized access risk
-
Limited Input Validation
- Minimal error checking for user inputs
- No validation for duplicate IDs
- Impact: Potential for data corruption
-
Method Naming Inconsistency
get_officer_position()actually sets the position (should beset_officer_position())- Violates getter/setter naming conventions
-
Namespace Pollution
using namespace std;can cause naming conflicts- Not recommended for larger projects
-
Random Number Generation
- Uses C-style
rand()instead of modern<random>library - Seeded only once during case creation
- Uses C-style
-
Criminal Removal Logic
- Requires manual entry of punishment duration for validation
- Prone to user input errors
-
Case-Criminal Relationship
- Solved cases automatically create criminal records
- No bidirectional relationship maintenance
- Duplicate criminal entries possible
-
Search Limitations
- Witness search by age may return multiple results but only shows first match
- No search by name or partial matching
-
Magic Numbers
- Hardcoded values (e.g., password length = 7)
- Cell numbers and punishment durations randomly generated without bounds checking
-
Console Display
- No pagination for large datasets
- Limited formatting options
- Database Integration: Implement SQLite or MySQL for persistent storage
- Cross-Platform Support: Replace platform-specific headers with portable alternatives
- Enhanced Security: Implement proper authentication with encrypted password storage
- Input Validation: Add comprehensive validation for all user inputs
- File I/O: Enable data export/import (CSV, JSON)
- Advanced Search: Multi-criteria search with partial matching
- Relationship Management: Proper foreign key relationships between entities
- Unit Testing: Implement test suite for critical functions
- GUI Interface: Develop graphical interface using Qt or similar framework
- Reporting System: Generate formatted reports and statistics
- User Roles: Implement role-based access control
- Audit Logging: Track all system operations with timestamps
This project is part of an academic assignment (Student ID: 2107004). Contributions, suggestions, and bug reports are welcome for educational purposes.
This project is developed for educational purposes. Please ensure compliance with your institution's academic integrity policies before using or modifying this code.
Project Type: Console Application
Course: Object-Oriented Programming (OOP)
Student ID: 2107004
Development Period: 2023-2024 Academic Year