Skip to content

Bogdan-ca/SkiResortManager---oop-project

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

18 Commits
 
 
 
 
 
 

Repository files navigation

Ski Resort Management System 🎿

A comprehensive C++ Object-Oriented Programming project for managing ski resort operations, including skiers, staff, slopes, and ski lifts.

📋 Project Overview

This application is a complete ski resort management system built as a university project for the Object-Oriented Programming (POO) course. It demonstrates advanced C++ concepts and provides full CRUD (Create, Read, Update, Delete) functionality for managing all aspects of a ski resort.

✨ Features

Core Functionality

  • Entity Management: Complete CRUD operations for 6 different entity types
  • Relationship Management: Complex bidirectional associations between entities
  • Data Persistence: Import/Export functionality to save and load data from files
  • Interactive Menu: User-friendly console interface for all operations
  • Capacity Management: Automatic validation of resort capacity constraints
  • Cascade Operations: Intelligent handling of dependent entity relationships

Managed Entities

  1. Skiers - Track resort visitors with skill levels (beginner, intermediate, advanced)
  2. Workers - Manage staff members with positions and salaries
  3. Instructors - Special type combining skier and worker attributes (multiple inheritance)
  4. Slopes - Ski runs with difficulty levels, length, and operational status
  5. Ski Lifts - Transportation infrastructure with capacity and type information
  6. Ski Resorts - Main entity coordinating all other components

🛠️ Technologies & Concepts

C++ Features Implemented

  • Object-Oriented Programming: Classes, inheritance, polymorphism
  • Virtual Inheritance: Diamond problem resolution for Instructor class
  • Templates: Generic EntityManager for reusable entity handling
  • Operator Overloading: 15+ operators per class (++, --, +, -, [], ==, <, >)
  • STL Containers: vector, list for efficient data management
  • Abstract Interfaces: IOInterface for standardized I/O operations
  • Design Patterns:
    • Singleton Pattern (Menu class)
    • Template Method Pattern (EntityManager)
  • Exception Handling: Comprehensive error management with try-catch blocks
  • File I/O: Stream-based data persistence using fstream
  • Memory Management: Custom destructors, proper resource cleanup

Key OOP Principles

  • ✅ Encapsulation
  • ✅ Inheritance (single, multiple, virtual)
  • ✅ Polymorphism (runtime and compile-time)
  • ✅ Abstraction
  • ✅ SOLID principles application

🚀 Getting Started

Prerequisites

  • C++ Compiler (GCC/MinGW recommended)
  • C++11 or later
  • Windows/Linux/MacOS

Compilation

Using GCC/MinGW:

g++ -o SkiResort SkiResor.cpp -std=c++11

Using the provided VS Code task:

# Press Ctrl+Shift+B (Windows/Linux) or Cmd+Shift+B (Mac)
# Select "C/C++: gcc.exe build active file"

Running the Application

./SkiResort.exe  # Windows
./SkiResort      # Linux/Mac

📖 Usage Guide

Main Menu Options

  1. Create - Add new entities (skiers, workers, slopes, etc.)
  2. Read - Display entity information by ID or show all
  3. Update - Modify existing entity attributes
  4. Delete - Remove entities from the system
  5. Export - Save data to a file
  6. Import - Load data from a file
  7. Exit - Clean up and exit the application

Example Workflow

Creating a Ski Resort

  1. Select option 1 (Create)
  2. Select option 6 (Ski Resort)
  3. Enter resort details:
    • Name: "Alpine Paradise"
    • Location: "Swiss Alps"
    • Snow conditions: "mare" (excellent)
    • Status: 1 (open)
    • Capacity: 500

Adding a Skier to a Resort

  1. Select option 1 (Create)
  2. Select option 1 (Skier)
  3. Enter skier details
  4. Choose 0 to assign to a resort
  5. Enter resort ID or -1 to view all resorts

Managing Slopes and Lifts

  • Slopes can be assigned to ski lifts
  • Lifts automatically manage their associated slopes
  • Opening/closing a lift affects all connected slopes

Data Persistence

Export Data

Menu Option: 5 (Export)
Entity Type: 6 (Ski Resort)
Filename: resort_data.txt

Import Data

Menu Option: 6 (Import)
Entity Type: 6 (Ski Resort)
Filename: resort_data.txt

🏗️ Architecture

Class Hierarchy

IDclass (Unique ID generation)
├── Skier
├── Worker
├── Instructor (virtual inheritance from Skier + Worker)
├── Slope
├── SkiLift
└── SkiResort

IOInterface (Abstract interface)
├── All entity classes implement read/write methods

Person (Base class)
├── Skier
├── Worker
└── Instructor

SkiResortManager (Management functionality)
└── SkiResort

EntityManager Template

Generic template class providing:

  • Static entity collection management
  • CRUD operation templates
  • File I/O operations
  • Entity lookup by ID
  • Batch operations

Relationships

  • One-to-Many: Resort → Skiers, Workers, Lifts, Slopes
  • One-to-Many: SkiLift → Slopes
  • Many-to-One: Multiple entities → Single Resort
  • Bidirectional: Automatic synchronization of relationships

💡 Key Implementation Details

Unique ID System

Each entity receives a unique auto-incremented ID upon creation via the IDclass base class.

Capacity Management

// Resorts enforce capacity limits
if (resort->getSkierSize() >= resort->getCapacity()) {
    throw std::length_error("Resort has reached maximum capacity");
}

Memory Safety

  • Proper destructor chains ensure no memory leaks
  • Automatic cleanup when deleting entities
  • Relationship integrity maintained during deletions

Operator Overloading Examples

Skier s1 = skier1 + 5;        // Age increment
SkiResort combined = resort1 + resort2;  // Resort merging
if (slope1 > 1000) { ... }    // Length comparison

📊 Project Statistics

  • Total Lines of Code: ~1,889
  • Classes: 11 (6 entity classes + 5 utility classes)
  • Operators Overloaded: 90+ (15 per entity class)
  • Design Patterns: 2 (Singleton, Template Method)
  • Inheritance Types: Single, Multiple, Virtual

🎓 Learning Outcomes

This project demonstrates mastery of:

  • Advanced C++ programming techniques
  • Object-oriented design principles
  • Memory management and resource handling
  • Template metaprogramming
  • Complex relationship modeling
  • Error handling and validation
  • File I/O and data persistence
  • Software architecture patterns

🐛 Error Handling

The system includes comprehensive exception handling for:

  • Invalid arguments (null pointers, invalid IDs)
  • Capacity overflow situations
  • File I/O errors (missing files, write failures)
  • Resource not found scenarios
  • Memory allocation failures

🤝 Contributing

This is an academic project. For educational purposes:

  1. Review the code structure
  2. Understand the OOP concepts applied
  3. Experiment with additional features
  4. Optimize existing implementations

📝 License

This project was created for educational purposes as part of a university course.

👨‍💻 Author

Bogdan Caraeane

  • University Project - Object-Oriented Programming (POO)
  • Academic Year: 2024-2025, Semester 2

🔮 Future Enhancements

Potential improvements:

  • GUI implementation using Qt or wxWidgets
  • Database integration (SQLite/MySQL)
  • Advanced search and filtering capabilities
  • Booking and reservation system
  • Statistical reports and analytics
  • Multi-language support
  • Unit testing framework integration
  • API for external integrations

📞 Support

For questions or discussions about the implementation:

  • Review the inline code comments
  • Analyze the class relationships
  • Study the operator overloading implementations
  • Examine the template usage patterns

Note: This project demonstrates academic understanding of C++ and OOP principles. It serves as a portfolio piece showcasing software engineering capabilities.


Built with ❤️ and lots of C++ compilation errors 😄

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages