School Project Management System with Group Assignment and Deadlines

C++ School Project Management System for assigning student groups, setting deadlines, and tracking project status with classes and vectors.

Brief Introduction

School Project Management System with Group Assignment and Deadlines (cpp)
DESCRIPTION:
A C++ program that allows managing school projects by assigning student groups and deadlines. The system enables adding projects, assigning students to groups, setting deadlines, and displaying project status. It is a complete and robust example of data management with classes, vectors, and input/output handling.

ADDITIONAL NOTES:
The program is ready to use in a desktop environment with a modern C++ compiler. It can be extended for file saving or graphical interfaces. Date management is simplified with strings but can be improved with specific libraries.

EXPLANATIONS:
- The Project class contains basic information about a project: name, list of students, and deadline.
- The ProjectManager class uses a vector of Project to manage multiple projects simultaneously.
- The addProject method adds a new project with name and deadline.
- The assignStudentToProject method allows adding a student to an existing project.
- The displayProjects method shows all projects with their groups and deadlines.
- The main provides a simple text menu to interact with the system.

Example Code: cpp

#include <iostream>
#include <vector>
#include <string>
#include <sstream>

// Class representing a school project
class Project {
private:
    std::string name;                        // Project name
    std::vector<std::string> students;     // List of students assigned to the project
    std::string deadline;                   // Project deadline (string format, e.g. "2024-06-30")

public:
    // Constructor
    Project(const std::string& name, const std::string& deadline) : name(name), deadline(deadline) {}

    // Adds a student to the group
    void addStudent(const std::string& student) {
        students.push_back(student);
    }

    // Gets the project name
    std::string getName() const {
        return name;
    }

    // Gets the deadline
    std::string getDeadline() const {
        return deadline;
    }

    // Displays project information
    void display() const {
        std::cout << "Project: " << name << "\n";
        std::cout << "Deadline: " << deadline << "\n";
        std::cout << "Student group: ";
        if (students.empty()) {
            std::cout << "No students assigned." << std::endl;
        } else {
            for (size_t i = 0; i < students.size(); ++i) {
                std::cout << students[i];
                if (i != students.size() - 1) std::cout << ", ";
            }
            std::cout << std::endl;
        }
        std::cout << "-----------------------------" << std::endl;
    }
};

// Class managing multiple projects
class ProjectManager {
private:
    std::vector<Project> projects;  // List of projects

public:
    // Adds a new project
    void addProject(const std::string& name, const std::string& deadline) {
        projects.emplace_back(name, deadline);
        std::cout << "Project '" << name << "' added with deadline " << deadline << ".\n";
    }

    // Assigns a student to an existing project
    void assignStudentToProject(const std::string& projectName, const std::string& studentName) {
        for (auto& project : projects) {
            if (project.getName() == projectName) {
                project.addStudent(studentName);
                std::cout << "Student '" << studentName << "' assigned to project '" << projectName << "'.\n";
                return;
            }
        }
        std::cout << "Project '" << projectName << "' not found.\n";
    }

    // Displays all projects
    void displayProjects() const {
        if (projects.empty()) {
            std::cout << "No projects available.\n";
            return;
        }
        std::cout << "Project list:\n";
        for (const auto& project : projects) {
            project.display();
        }
    }
};

// Function to read a line of input with prompt
std::string readLine(const std::string& prompt) {
    std::cout << prompt;
    std::string input;
    std::getline(std::cin, input);
    return input;
}

int main() {
    ProjectManager manager;
    bool running = true;

    while (running) {
        std::cout << "\n--- School Project Management ---\n";
        std::cout << "1. Add new project\n";
        std::cout << "2. Assign student to project\n";
        std::cout << "3. Display projects\n";
        std::cout << "4. Exit\n";
        std::cout << "Select an option: ";

        std::string choiceStr;
        std::getline(std::cin, choiceStr);
        int choice = 0;
        std::stringstream ss(choiceStr);
        ss >> choice;

        switch (choice) {
            case 1: {
                std::string name = readLine("Enter project name: ");
                std::string deadline = readLine("Enter deadline (YYYY-MM-DD): ");
                manager.addProject(name, deadline);
                break;
            }
            case 2: {
                std::string projectName = readLine("Enter project name to assign student: ");
                std::string studentName = readLine("Enter student name: ");
                manager.assignStudentToProject(projectName, studentName);
                break;
            }
            case 3: {
                manager.displayProjects();
                break;
            }
            case 4: {
                running = false;
                std::cout << "Exiting program.\n";
                break;
            }
            default: {
                std::cout << "Invalid option, please try again.\n";
                break;
            }
        }
    }

    return 0;
}
×
×
×
Do you want to regenerate the answer?
×
Export chat
Choose export format
Generazione PDF in corso…
Allegati
×
You are about to close the chat and switch to the image generator. If you are not logged in, you will lose our chat. Do you confirm?
You are viewing a shared chat in temporary mode. It will not be saved.
×
Saved prompts
×
Private note
×
Label
×
Search all chats
×
Your insights
Analyzing…
×
AI Preferences
Assistant name 30
Answer length
AI model
Structured answers
Include examples
Use emojis
Guide me, don't solve Hints and questions instead of a ready answer
More settings →
×
Share this chat
Anyone opening this link can view the chat or add it to their profile as their own chat.
Note: the chat attachments will be shared too. Anyone who adds it will receive a copy of the files in their own folder.
Shared chat
Someone shared a chat with you. Do you want to just view it or add it to your chats?
Note: the chat attachments will be shared too. Anyone who adds it will receive a copy of the files in their own folder.
×

Saved messages

Loading...

×

Chat History

example-programs · CHAT HISTORY

Loading...

AI Preferences

×
  • BasicQuick and essential answers for study
  • MediumHigher quality for study and programming
  • AdvancedComplex reasoning and detailed analysis
Explain Steps

What do you need?

Project class: represents a project with name, student group, and deadline.

ProjectManager class: manages a list of projects, with methods to add, modify, and display projects.

Use of STL vector and string for dynamic data management.

Standard input/output for user interaction.

No external dependencies, only standard C++ libraries (iostream, vector, string, sstream, chrono).

Configuration: no hardware configuration required, standalone console program.

Arduino: not applicable, desktop C++ program.

Software: C++11 or higher compiler required.

Similar Topics

Conversion from Euro to Other Currencies with Fixed Rates
Simple C++ program converting euros to USD, GBP, and JPY using fixed rates. User inputs amount; output shows converted value with two decimals.
Text-based Contact Book with Name Search
C++ text-based contact book program with insertion, display, and case-insensitive name search using vectors and modular functions for easy management.
Managing a Book List with Saving to a Text File
C++ program for managing a book list with add, display, and save features using file I/O and simple data structures for persistence.
Supermarket Queue Simulator with std::queue
Supermarket Queue Simulator in C++ using std::queue to model FIFO customer service, demonstrating queue operations and status updates in a console program.
Warehouse Inventory Management with Structures and Vectors
Complete C++ warehouse inventory management example using structures and vectors for adding, removing, searching, and displaying products efficiently.
Mini daily agenda with appointments sorted by time
Simple C++ program for managing daily appointments with automatic time sorting and console input/output. Ideal for organized daily scheduling.
Random Password Generator with Configurable Parameters
C++ random password generator with configurable length and character types including uppercase, lowercase, numbers, and symbols for secure passwords.
Textual login system with three maximum attempts
Simple C++ textual login system with three maximum attempts, demonstrating basic username and password validation for beginner programmers.