Scenario-Based Questions on Classes and Objects in C++

This collection includes creative C++ problems that help students build strong concepts of classes and objects through real-life scenarios like car rentals, hospital systems, and disaster response. Each problem involves taking user input and using class-based logic with methods, attributes, and constructors to solve the task. It’s ideal for learners who have already practiced operators, if-else statements, arrays, and loops, and are now ready to apply their knowledge using classes and objects in practical coding challenges. Each question comes with a simple explanation, test case, and complete solution.

Book Record Keeper

A small bookstore with books on display.
Book Store
You are managing a small bookstore that needs to store information about the books available for sale. Each book has a title, author name, and price. Customers often ask for book details. Write a C++ program that takes the book details as input from the user and displays them clearly.

Test Case 
Input
Enter the book title: The Alchemist
Enter the author name: Paulo Coehlo
Enter the price: 15.99
Expected Output
Book Details:
Title: The Alchemist
Author: Paulo Coehlo
Price: $15.99
  • The program starts by creating a Book class with private members, title, author, and price, initialized through a default constructor.
  • When the program runs, it creates an object of the Book class.
  • The input() function asks the user to enter the title, author name, and price of the book, and stores these values in the respective variables.
  • The display() function is then called to show the details of the book entered by the user.
#include <iostream>
using namespace std;

class Book {
private:
    string title;
    string author;
    float price;

public:
    Book() {
        title = "";
        author = "";
        price = 0.0;
    }

    void input() {
        cout << "Enter the book title: ";
        getline(cin, title);
        cout << "Enter the author name: ";
        getline(cin, author);
        cout << "Enter the price: ";
        cin >> price;
    }

    void display() {
        cout << "\nBook Details:\n";
        cout << "Title: " << title << endl;
        cout << "Author: " << author << endl;
        cout << "Price: $" << price << endl;
    }
};

int main() {
    Book b;
    b.input();
    b.display();
    return 0;
}

Movie Ticket Calculator

A person asking for the final ticket cost at a cinema counter.
Ticket Price
A cinema hall is offering different ticket prices based on the age of the viewer. Children under 12 years get a 50% discount. The ticket counter staff needs a tool to automatically calculate the correct ticket price for each customer. Write a C++ program that uses a class and an object to take the customer’s age and ticket base price as input, calculate the final price, and display it.

Test Case 
Input
Enter your age: 10
Enter the base ticket price: 23
Expected Output
Final Ticket Price: $11.5
  • The program starts by creating a Ticket class with private members: age and basePrice, initialized using a default constructor.
  • When the program runs, it creates an object of the Ticket class.
  • The input() function asks the user to enter their age and the base ticket price and stores these values in the respective variables.
  • Next, the calculate() function checks if the age is less than 12. If it is, the program applies a 50% discount by multiplying the base price by 0.5.
  • The final ticket price is then displayed to the user based on whether a discount was applied or not.
#include <iostream>
using namespace std;

class Ticket {
private:
    int age;
    float basePrice;

public:
    Ticket() {
        age = 0;
        basePrice = 0.0;
    }

    void input() {
        cout << "Enter your age: ";
        cin >> age;
        cout << "Enter the base ticket price: ";
        cin >> basePrice;
    }

    void calculate() {
        float finalPrice = basePrice;
        if (age < 12) {
            finalPrice = basePrice * 0.5;
        }
        cout << "Final Ticket Price: $" << finalPrice << endl;
    }
};

int main() {
    Ticket t;
    t.input();
    t.calculate();
    return 0;
}

Student Grade Evaluator

A teacher giving a student an F grade.
Student Grade Evaluator
You are building a simple grading system for a school. The system needs to store a student’s name and marks in an object, then assign a grade based on the marks. If the student’s marks are 90 or above, they receive an A. If their marks are between 80 and 89, they receive a B. If their marks are between 70 and 79, they receive a C. If their marks are between 60 and 69, they receive a D. If their marks are below 60, they receive an F. Write a C++ program that takes the student’s name and marks as input, stores the values in an object, and then displays their grade.

Test Case 
Input
Enter the student’s name: Jack
Enter the student’s marks: 86
Expected Output
Student Name: Jack
Marks: 86
Grade: B
  • The program starts by creating a Student object to store the student’s name and marks.
  • It then calls the inputDetails() function to prompt the user to enter the student’s name and marks. These inputs are saved in the name and marks variables within the object.
  • After that, the program calls the displayGrade() function, which checks the marks entered and assigns a grade based on the following rules.
  • If the marks are 90 or higher, the grade is A.
  • If the marks are between 80 and 89, the grade is B.
  • If the marks are between 70 and 79, the grade is C.
  • If the marks are between 60 and 69, the grade is D.
  • If the marks are below 60, the grade is F.
  • The displayGrade() function then displays the grade along with the student’s name and marks.
#include <iostream>
using namespace std;

class Student {
    string name;
    int marks;

public:
    Student() {
        name = "";
        marks = 0;
    }

    void inputDetails() {
        cout << "Enter the student's name: ";
        getline(cin, name);
        cout << "Enter the student's marks: ";
        cin >> marks;
    }

    void displayGrade() {
        cout << "\nStudent Name: " << name << "\nMarks: " << marks << "\nGrade: ";
        if (marks >= 90) {
            cout << "A";
        }
        else if (marks >= 80) {
            cout << "B";
        }
        else if (marks >= 70) {
            cout << "C";
        }
        else if (marks >= 60) {
            cout << "D";
        }
        else {
            cout << "F";
        }
        cout << endl;
    }
};

int main() {
    Student s;
    s.inputDetails();
    s.displayGrade();
    return 0;
}

Bank Account System

A woman checking balance and wondering how much to deposit.
Bank Account
You’ve just landed a part-time job at a small bank, and your first task is to build a basic system to handle customer accounts. Each account should let the user deposit money, withdraw funds, or check their current balance. The system uses a class to manage account data and stores values in an object. Based on the user’s choice, different functions are called to perform these actions. Write a C++ program that does this using a simple menu.

Test Case 
Input
Bank Account Menu
1- Deposit
2- Withdraw
3- View Balance
4- Exit
Enter your choice: 1
Enter amount to deposit: 500

Enter your choice: 3

Enter your choice: 2
Enter amount to withdraw: 100

Enter your choice: 4
Expected Output
Deposited: 500

Current balance: 500

Withdrawn: 100

Exiting program…
  • The program begins by creating an object of the BankAccount class, which stores the user’s account balance. This object will be used to perform all the required operations.
  • Next, the program displays a menu in a do-while loop. This loop keeps running until the user chooses to exit.
  • Inside the loop, the program shows the menu options to the user: deposit money, withdraw money, check balance, or exit. The user is prompted to enter their choice, which is saved in the variable choice.
  • If the user chooses to deposit money, the program asks how much they want to deposit. This amount is stored in the amount variable and passed to the deposit() function using the object. The function adds this amount to the balance.
  • If the user selects withdraw, the program asks for the withdrawal amount. This value is saved in the amount variable and passed to the withdraw() function using the object. The function checks if the balance is enough and then subtracts the amount from the balance.
  • If the user wants to check their balance, the program calls the checkBalance() function using the object, which shows the current balance on the screen.
  • If the user enters 4, the program prints a goodbye message and exits the loop.
#include <iostream>
using namespace std;

class BankAccount {
private:
    double balance;

public:
    BankAccount() {
        balance = 0.0;
    }

    void deposit(double amount) {
        if (amount > 0) {
            balance += amount;
            cout << "Deposited: " << amount << endl;
        } else {
            cout << "Invalid amount! Deposit failed." << endl;
        }
    }

    void withdraw(double amount) {
        if (amount > 0 && amount <= balance) {
            balance -= amount;
            cout << "Withdrawn: " << amount << endl;
        } else if (amount > balance) {
            cout << "Insufficient balance! Withdrawal failed." << endl;
        } else {
            cout << "Invalid amount! Withdrawal failed." << endl;
        }
    }

    void displayBalance() {
        cout << "Current balance: " << balance << endl;
    }
};

int main() {
    BankAccount account;
    int choice;
    double amount;

    while (true) {
        cout << "\nBank Account Menu\n";
        cout << "1. Deposit\n";
        cout << "2. Withdraw\n";
        cout << "3. View Balance\n";
        cout << "4. Exit\n";
        cout << "Enter your choice: ";
        cin >> choice;

        if (choice == 1) {
            cout << "Enter amount to deposit: ";
            cin >> amount;
            account.deposit(amount);
        } else if (choice == 2) {
            cout << "Enter amount to withdraw: ";
            cin >> amount;
            account.withdraw(amount);
        } else if (choice == 3) {
            account.displayBalance();
        } else if (choice == 4) {
            cout << "Exiting program..." << endl;
            break;
        } else {
            cout << "Invalid choice! Please try again." << endl;
        }
    }

    return 0;
}

Smart Courier

A worker weighing a package and giving the shipping cost.
Courier
A courier service is building a system to help calculate shipping costs for packages. Each package has an ID, a weight in kilograms, a destination city, and an indication of whether it is fragile. The shipping cost is based on the weight of the package. If the weight is up to 5 kg, the rate is 500 PKR. For packages weighing more than 5 kg and up to 20 kg, the rate is 1000 PKR. If the weight exceeds 20 kg, then the rate is 2000 PKR. Fragile items have an additional charge of 300. Write a C++ program that takes these inputs from the user, stores them in an object, and calculates the total shipping cost.

Test Case 
Input
Enter Package ID: PKG123
Enter Destination City: Lahore
Enter Weight (in kg): 8.5
Is the package fragile? (1 for Yes, 0 for No): 1
Expected Output
Package ID: PKG123
Destination: Lahore
Weight: 8.5 kg
Fragile: Yes
Total Shipping Cost: 1300 PKR
  • The program starts by creating an object of the Package class named p.
  • It first calls the inputDetails() function, which prompts the user to enter the package ID, destination city, weight of the package in kilograms, and whether the package is fragile or not. These values are stored in the corresponding data members of the object.
  • After taking input, the program calls the calculateCost() function.
  • The calculateCost() function uses simple if-else conditions to decide the shipping cost based on the weight of the package.
  • If the weight is 5 kg or less, the base cost is 500 PKR.
  • If the weight is more than 5 kg but less than or equal to 20 kg, the cost is 1000 PKR.
  • If the weight is above 20 kg, the cost is set to 2000 PKR.
  • Then, if the package is fragile (based on user input), an extra 300 PKR is added to the shipping cost.
  • Finally, the program calls the displayDetails() function to show all the entered package details along with the total shipping cost.
#include <iostream>
using namespace std;

class Package {
    string packageID;
    float weight;
    string destination;
    bool isFragile;

public:
    Package() {
        packageID = "";
        weight = 0.0;
        destination = "";
        isFragile = false;
    }

    void inputDetails() {
        cout << "Enter Package ID: ";
        getline(cin, packageID);
        cout << "Enter Destination City: ";
        getline(cin, destination);
        cout << "Enter Weight (in kg): ";
        cin >> weight;
        cout << "Is the package fragile? (1 for Yes, 0 for No): ";
        cin >> isFragile;
    }

    void calculateCost() {
        int cost = 0;

        if (weight <= 5) {
            cost = 500;
        } else if (weight <= 20) {
            cost = 1000;
        } else {
            cost = 2000;
        }

        if (isFragile) {
            cost += 300;
        }

        cout << "\nPackage ID: " << packageID << endl;
        cout << "Destination: " << destination << endl;
        cout << "Weight: " << weight << " kg" << endl;
        cout << "Fragile: " << (isFragile ? "Yes" : "No") << endl;
        cout << "Total Shipping Cost: " << cost << " PKR" << endl;
    }
};

int main() {
    Package p;
    p.inputDetails();
    p.calculateCost();

    return 0;
}

Car Rental Showdown

A Honda car rental note showing Rs. 5000
Rental Car
You’re managing a car rental agency that rents out different types of cars. Each car has a model name, a daily rent price, and the number of days it is rented for. Customers can rent multiple cars. Your system needs to calculate and display the total rent for each customer based on the car’s rent per day and the number of days. Write a C++ program that stores the car rental information in objects and calculates and displays the total rent for each car rented by the customer.

Test Case 
Input
Enter number of cars rented: 2
Enter details for Car 1:
Enter model name: Civic
Enter daily rent (Rs.): 5000
Enter number of days rented: 3
Enter details for Car 2:
Enter model name: Corolla
Enter daily rent (Rs.): 4000
Enter number of days rented: 2
Expected Output
— Rental Summary —
Model: Civic
Daily Rent: Rs. 5000
Days Rented: 3
Total Rent: Rs. 15000
Model: Corolla
Daily Rent: Rs. 4000
Days Rented: 2
Total Rent: Rs. 8000
Total cost for the customer: Rs. 23000
  • The program starts by asking the user to enter the number of cars rented by the customer. This input is stored in the numCars variable.
  • An array of CarRental objects of size numCars is created. Each object represents a car rented by the customer.
  • In a loop, the program calls the input() method of each object to take input from the user which includes the model name, the daily rent, and the number of rental days.
  • After input is collected, the program enters a second for loop to calculate and display the total rent for each car. The calculateTotalRent() method multiplies the daily rent by the number of days rented to compute the total rent, which is stored in the object.
  • The display() method is called to show the details of each car which includes model name, rent per day, days rented, and total rent.
  • In addition to displaying individual totals, the program maintains a grandTotal variable. After displaying each car’s total rent, it adds it to grandTotal using the getTotalRent() method.
  • Once all cars are processed, the program displays the total cost for the customer by printing the final value of grandTotal.
#include <iostream>
#include <string>
using namespace std;

class CarRental {
private:
    string modelName;
    double dailyRent;
    int daysRented;
    double totalRent;

public:
    CarRental() {
        modelName = "";
        dailyRent = 0;
        daysRented = 0;
        totalRent = 0;
    }

    void input() {
        cout << "Enter model name: ";
        cin >> modelName;
        cout << "Enter daily rent (Rs.): ";
        cin >> dailyRent;
        cout << "Enter number of days rented: ";
        cin >> daysRented;
    }

    void calculateTotalRent() {
        totalRent = dailyRent * daysRented;
    }

    void display() const {
        cout << "\nModel: " << modelName;
        cout << "\nDaily Rent: Rs. " << dailyRent;
        cout << "\nDays Rented: " << daysRented;
        cout << "\nTotal Rent: Rs. " << totalRent << endl;
    }

    double getTotalRent() const {
        return totalRent;
    }
};

int main() {
    int numCars;
    double grandTotal = 0;

    cout << "Enter number of cars rented: ";
    cin >> numCars;

    CarRental cars[numCars];

    for (int i = 0; i < numCars; i++) {
        cout << "\nEnter details for Car " << i + 1 << ":\n";
        cars[i].input();
    }

    cout << "\n--- Rental Summary ---";
    for (int i = 0; i < numCars; i++) {
        cars[i].calculateTotalRent();
        cars[i].display();
        grandTotal += cars[i].getTotalRent();
    }

    cout << "\nTotal cost for the customer: Rs. " << grandTotal << endl;

    return 0;
}

Gym Member Progress Tracker

A man working out being told he's at the top of the leaderboard.
Gym Workout
You are managing a gym where each member participates in multiple workout sessions. During each session, a certain number of calories are burnt. The gym administration wants to track which member has burnt the most calories across all their sessions in a given month. This helps motivate members and identify top performers. Write a program in C++ that takes the number of members, and for each member takes the name, number of sessions, and calories burnt in each session as input. The program should calculate the total calories burnt by each member and display the name and calorie total of the top-performing member.

Test Case 
Input
Member 1:
Enter member name: Ayesha
Enter number of sessions: 3
Enter calories burnt in each session:
120 130 140
Member 2:
Enter member name: Ahmad
Enter number of sessions: 2
Enter calories burnt in each session:
200 220
Expected Output
Top Performer: Ahmad
Total Calories Burnt: 420
  • The program starts by asking the user to enter the number of gym members. This input is stored in the variable memberCount.
  • A Member class is defined to represent each gym member. It stores the member’s name, number of workout sessions, and an array to hold calories burnt in each session.
  • A loop runs for each member. During each iteration, the program asks the user to enter the member’s name, number of sessions, and the calories burnt in each session. These values are stored using the inputDetails() method of the Member class.
  • Once all members’ data has been entered, another loop is used to calculate the total calories burnt by each member. This is done using the totalCalories() method, which adds up all the session values stored in the array.
  • The program keeps track of the member with the highest total calories burnt using a comparison inside a loop. It initially assumes the first member is the top performer, then compares every other member’s total with the current maximum.
  • After processing all members, the program prints the name and total calories of the member who burnt the most.
#include <iostream>
#include <string>
using namespace std;

class Member {
public:
    string name;
    int sessions;
    int calories[10];

    void inputDetails() {
        cout << "Enter member name: ";
        cin >> name;
        cout << "Enter number of sessions: ";
        cin >> sessions;
        cout << "Enter calories burnt in each session:\n";
        for(int i = 0; i < sessions; i++) {
            cin >> calories[i];
        }
    }

    int totalCalories() {
        int total = 0;
        for(int i = 0; i < sessions; i++) {
            total += calories[i];
        }
        return total;
    }
};

int main() {
    int memberCount;
    cout << "Enter number of gym members: ";
    cin >> memberCount;

    Member members[memberCount];
    for(int i = 0; i < memberCount; i++) {
        cout << "\nMember " << i+1 << ":\n";
        members[i].inputDetails();
    }

    Member topMember = members[0];
    for(int i = 1; i < memberCount; i++) {
        if(members[i].totalCalories() > topMember.totalCalories()) {
            topMember = members[i];
        }
    }

    cout << "\nTop Performer: " << topMember.name;
    cout << "\nTotal Calories Burnt: " << topMember.totalCalories() << endl;

    return 0;
}

Game Scoreboard Manager

Two gamers playing with a big trophy in the background.
Game Tournament
You are developing a scoreboard system for a video game tournament. Each player has a unique username and plays multiple matches. Each match gives the player a score. The system must calculate the average score for each player and identify whether they qualify for the final round. A player qualifies if their average score is greater than or equal to 70. Write a program in C++ that takes the number of players, and for each player takes their username and scores in multiple matches as input. The program should calculate the average score of each player and display whether the player qualifies for the final round.

Test Case 
Input
Enter number of players: 2
Player 1:
Enter player username: Alpha
Enter number of matches played: 3
Enter scores for each match:
80 75 70
Player 2:
Enter player username: Bravo
Enter number of matches played: 3
Enter scores for each match:
60 65 50
Expected Output
Tournament Results:
Player: Alpha | Average Score: 75 | Status: Qualified
Player: Bravo | Average Score: 58.3333 | Status: Not Qualified
  • The program starts by asking the user to enter the number of players participating in the tournament. This input is saved in the numPlayers variable.
  • For each player, the program prompts the user to enter the player’s username and the number of matches they have played. These inputs are saved in the username and numMatches variables, respectively.
  • Next, using a for loop, the program takes the score for each match from the user and stores it in the scores array inside the Player class. This array stores individual match scores for each player.
  • The program then calculates the average score for each player by summing all the match scores using a loop and dividing the sum by numMatches. This is done using the averageScore() method.
  • After calculating the average, the program checks whether the average score is greater than or equal to 70. If it is, the player is marked as Qualified for the final round. Otherwise, they are marked as Not Qualified.
  • This process repeats for all players. Once all players have been processed, the program displays the username, average score, and qualification status for each player in the tournament.
#include <iostream>
#include <string>
using namespace std;

class Player {
public:
    string username;
    int numMatches;
    int scores[10];

    void inputPlayer() {
        cout << "Enter player username: ";
        cin >> username;
        cout << "Enter number of matches played: ";
        cin >> numMatches;
        cout << "Enter scores for each match:\n";
        for(int i = 0; i < numMatches; i++) {
            cin >> scores[i];
        }
    }

    double averageScore() {
        int sum = 0;
        for(int i = 0; i < numMatches; i++) {
            sum += scores[i];
        }
        return (double)sum / numMatches;
    }
};

int main() {
    int numPlayers;
    cout << "Enter number of players: ";
    cin >> numPlayers;

    Player players[numPlayers];
    for(int i = 0; i < numPlayers; i++) {
        cout << "\nPlayer " << i + 1 << ":\n";
        players[i].inputPlayer();
    }

    cout << "\nTournament Results:\n";
    for(int i = 0; i < numPlayers; i++) {
        double avg = players[i].averageScore();
        cout << "Player: " << players[i].username << " | Average Score: " << avg;
        if(avg >= 70) {
            cout << " | Status: Qualified\n";
        } else {
            cout << " | Status: Not Qualified\n";
        }
    }

    return 0;
}

Bill Splitter for Friends

A group of people smiling around a dinner table.
Friends’ Hangout
You and your friends often hang out and share expenses. For each outing, every friend contributes a certain amount of money. You want to develop a system that calculates the total amount spent, the equal share for each friend, and identifies which friends need to pay more or get refunded to balance the expense equally. Write a program in C++ that takes the number of friends, and for each friend takes their name and amount contributed. The program should calculate the equal share and display for each friend whether they need to pay more or receive a refund.
Test Case 
Input
Enter number of friends: 3
Friend 1:
Enter friend name: Ali
Enter amount paid: 200
Friend 2:
Enter friend name: Sara
Enter amount paid: 150
Friend 3:
Enter friend name: Usman
Enter amount paid: 250
Expected Output
— Bill Summary —
Total Expense: $600
Equal Share Per Friend: $200
Ali: Has no balance to settle.
Sara: Needs to pay $50
Usman: Gets refunded $50
  • The program starts by asking the user to enter the number of friends who contributed to the total expense. This input is saved in the friendCount variable.
  • For each friend, the program prompts the user to enter the friend’s name and the amount they paid. These inputs are received using a for loop and are stored in the attributes name and amountPaid of each Friend object. This is done using the inputData() method of the Friend class.
  • Next, the program calculates the total expense contributed by all friends. It initializes a variable totalExpense to 0 and uses another for loop inside the calculateTotal() method to add each friend’s contribution to this total.
  • Once the total is computed, the program calculates the equal share per friend by dividing the total expense by the number of friends. This value is stored in the equalShare variable inside the calculateEqualShare() method.
  • The program then uses another loop to check how much each friend paid in comparison to the equal share. This comparison is performed in the displayBalance() method of the Friend class.
    • If a friend paid more than the equal share, the program prints how much they should be refunded.
    • If a friend paid less, it prints how much they still owe.
    • If the contribution matches exactly, it states that the balance is settled.
  • This process is repeated for all friends. Once all calculations are completed, the program displays the total expense, the equal share, and the balance status (refund or payment) for each friend.
#include <iostream>
#include <string>
using namespace std;

class Friend {
public:
    string name;
    double amountPaid;

    void inputData() {
        cout << "Enter friend name: ";
        cin >> name;
        cout << "Enter amount paid: ";
        cin >> amountPaid;
    }

    void displayBalance(double equalShare) {
        double diff = amountPaid - equalShare;
        cout << name << ": ";
        if (diff > 0) {
            cout << "Gets refunded $" << diff << endl;
        } else if (diff < 0) {
            cout << "Needs to pay $" << -diff << endl;
        } else {
            cout << "Has no balance to settle." << endl;
        }
    }
};

class BillSplitter {
private:
    Friend friends[10];
    int friendCount;
    double totalExpense;
    double equalShare;

public:
    void inputAllFriends() {
        cout << "Enter number of friends: ";
        cin >> friendCount;
        for (int i = 0; i < friendCount; i++) {
            cout << "\nFriend " << i + 1 << ":\n";
            friends[i].inputData();
        }
    }

    void calculateTotal() {
        totalExpense = 0;
        for (int i = 0; i < friendCount; i++) {
            totalExpense += friends[i].amountPaid;
        }
    }

    void calculateEqualShare() {
        if (friendCount > 0) {
            equalShare = totalExpense / friendCount;
        } else {
            equalShare = 0;
        }
    }

    void displaySummary() {
        cout << "\n--- Bill Summary ---\n";
        cout << "Total Expense: $" << totalExpense << endl;
        cout << "Equal Share Per Friend: $" << equalShare << "\n\n";

        for (int i = 0; i < friendCount; i++) {
            friends[i].displayBalance(equalShare);
        }
    }

    void process() {
        inputAllFriends();
        calculateTotal();
        calculateEqualShare();
        displaySummary();
    }
};

int main() {
    BillSplitter splitter;
    splitter.process();
    return 0;
}

Advanced Inventory Management System

A woman and child shopping.
Grocery Store
You are developing an inventory management system for a mid-sized grocery store that tracks essential product information. Each product has a name, a product ID, a price per unit, and a quantity currently available in stock. The system must automatically calculate the stock value for each product when the product is added. After entering the data for all products, the system should generate a complete inventory report. Additionally, the system must identify all products that share the lowest stock value, which indicates they are understocked and may need to be restocked urgently. The system must handle multiple products with the same lowest stock value and highlight them in the report. Write a program in C++ that stores up to 10 product records, calculates stock value, and displays all product details. It must also identify and flag all products that share the lowest stock value. The program should include both a default constructor and a parameterized constructor.

Test Case 
Input
Enter number of products (1 to 10): 3
Enter details for product 1:
Enter product name: oil
Enter product ID: P001
Enter price: 250
Enter quantity: 4
Enter details for product 2:
Enter product name: Rice
Enter product ID: P002
Enter price: 100
Enter quantity: 5
Enter details for product 3:
Enter product name: Salt
Enter product ID: P003
Enter price: 40
Enter quantity: 2
Expected Output
— Inventory Report —
Product ID: P001
Name: oil
Price: Rs. 250
Quantity: 4
Stock Value: Rs. 1000
Product ID: P002
Name: Rice
Price: Rs. 100
Quantity: 5
Stock Value: Rs. 500
Product ID: P003
Name: Salt
Price: Rs. 40
Quantity: 2
Stock Value: Rs. 80 (Low Stock)
  • The program starts by asking the user to enter the number of products to add. This value is stored in the numProducts variable and must be between 1 and 10. If the user enters a value outside this range, the program exits with an error message.
  • The program defines a class Product with attributes name, productID, price, quantity, and stockValue. A constructor is used to initialize the name, ID, price, and quantity, and automatically compute the stock value using the formula stockValue = price × quantity.
  • All product objects are stored in a static array of type Product, which is defined with a fixed size of 10.
  • After all product entries are complete, the program loops through the array to find the minimum stock value.
  • It then loops again to display all products using the display() method of the class.
  • If a product’s stock value matches the minimum value, it is labeled as “Low Stock.
#include <iostream>
#include <string>
using namespace std;

class Product {
private:
    string name;
    string productID;
    double price;
    int quantity;
    double stockValue;

public:
    Product() {
        name = "";
        productID = "";
        price = 0;
        quantity = 0;
        stockValue = 0;
    }

    Product(string n, string id, double p, int q) {
        name = n;
        productID = id;
        price = p;
        quantity = q;
        stockValue = price * quantity;
    }

    double getStockValue() const {
        return stockValue;
    }

    void display(bool lowStock = false) const {
        cout << "\nProduct ID: " << productID;
        cout << "\nName: " << name;
        cout << "\nPrice: Rs. " << price;
        cout << "\nQuantity: " << quantity;
        cout << "\nStock Value: Rs. " << stockValue;
        if (lowStock) {
            cout << " (Low Stock)";
        }
        cout << endl;
    }

    void input() {
        cout << "Enter product name: ";
        cin >> name;
        cout << "Enter product ID: ";
        cin >> productID;
        cout << "Enter price: ";
        cin >> price;
        cout << "Enter quantity: ";
        cin >> quantity;
        stockValue = price * quantity;
    }
};

int main() {
    const int MAX_PRODUCTS = 10;
    Product products[MAX_PRODUCTS];
    int numProducts;

    cout << "Enter number of products (1 to 10): ";
    cin >> numProducts;

    if (numProducts < 1 || numProducts > MAX_PRODUCTS) {
        cout << "Invalid number of products. Exiting.\n";
        return 1;
    }

    for (int i = 0; i < numProducts; i++) {
        cout << "\nEnter details for product " << i + 1 << ":\n";
        products[i].input();
    }
    double minStockValue = products[0].getStockValue();
    for (int i = 1; i < numProducts; i++) {
        if (products[i].getStockValue() < minStockValue) {
            minStockValue = products[i].getStockValue();
        }
    }

    cout << "\n--- Inventory Report ---";
    for (int i = 0; i < numProducts; i++) {
        bool isLow = (products[i].getStockValue() == minStockValue);
        products[i].display(isLow);
    }

    return 0;
}

Fleet Maintenance and Fuel Efficiency Tracker

A delivery van packed with boxes.
Delivery Van
You are managing a nationwide delivery company that operates a large fleet of vehicles. Each vehicle has a unique ID, model name, and a fuel efficiency rating in kilometers per liter. Every vehicle also has a maintenance record that stores the date of the last maintenance check, the number of kilometers driven since that check, and whether it passed its last inspection. Before dispatching vehicles for long-distance deliveries, the system must evaluate both fuel requirements for the trip and the vehicle’s maintenance status. A vehicle is deemed not fit for delivery if it has failed its last inspection or if it has traveled more than 5000 kilometers since its last maintenance. The system should accept any number of vehicles, calculate the fuel required for a given trip for each one, and display whether each vehicle can be dispatched or needs service. Only vehicles in good condition should be allowed to proceed. Write a C++ program that uses two classes to handle vehicle and maintenance details, and outputs a complete report showing trip fuel needs and maintenance status for each vehicle.

Test Case 
Input
Enter number of vehicles: 2
Enter trip distance (in kilometers): 300
Enter details for Vehicle 1:
Enter vehicle ID: V001
Enter model name: Hilux
Enter fuel efficiency (km/l): 12
Enter last maintenance check date (dd-mm-yyyy): 01-05-2024
Enter kilometers driven since last check: 3000
Did the vehicle pass the inspection? (y/n): y
Enter details for Vehicle 2:
Enter vehicle ID: V002
Enter model name: Fortuner
Enter fuel efficiency (km/l): 10
Enter last maintenance check date (dd-mm-yyyy): 01-04-2024
Enter kilometers driven since last check: 6200
Did the vehicle pass the inspection? (y/n): y
Expected Output
=== Fleet Dispatch Report ===
— Vehicle Report —
Vehicle ID: V001
Model Name: Hilux
Fuel Efficiency: 12 km/l
Trip Distance: 300 km
Fuel Required: 25 liters
Last Check Date: 01-05-2024
Kilometers Since Last Check: 3000
Inspection Passed: Yes
Dispatch Status: FIT FOR DELIVERY
— Vehicle Report —
Vehicle ID: V002
Model Name: Fortuner
Fuel Efficiency: 10 km/l
Trip Distance: 300 km
Fuel Required: 30 liters
Last Check Date: 01-04-2024
Kilometers Since Last Check: 6200
Inspection Passed: Yes
Dispatch Status: NOT FIT FOR DELIVERY (Service Required)
  • The program starts by asking the user to enter the number of vehicles. This input is saved in the numVehicles variable.
  • It also asks the user to enter the trip distance in kilometers, which is stored in the tripDistance variable.
  • The program defines two classes: MaintenanceCheck and Vehicle.
  • The MaintenanceCheck class stores the last maintenance check date, the kilometers driven since the last check, and whether the vehicle passed its last inspection.
  • The Vehicle class stores the vehicle ID, model name, fuel efficiency, and an object of the MaintenanceCheck class.
  • Inside the Vehicle class, the default constructor initializes all string and numeric values to default. The input() method is used to collect the vehicle ID, model name, fuel efficiency, and the complete maintenance check details.
  • The MaintenanceCheck class also contains its own input() method to get the date, kilometers since the last check, and inspection result from the user. The inspection result is validated using an if-else condition to convert the user’s input character into a Boolean flag.
  • The needsService() method in the MaintenanceCheck class checks whether the vehicle either failed its last inspection or has traveled more than 5000 kilometers since its last check. This is done using an if-else statement and returns true if the vehicle needs servicing.
  • Once all vehicles have been added using a loop, the program iterates over each vehicle again using a second loop. For each vehicle, it calculates the fuel required for the trip using the formula fuelRequired = tripDistance / fuelEfficiency.
  • The result is displayed along with the model, vehicle ID, fuel efficiency, trip distance, and maintenance status. The maintenance details are shown using the displayStatus() method of the MaintenanceCheck class.
  • Finally, the program prints the dispatch status. If the vehicle requires maintenance, it is labeled as NOT FIT FOR DELIVERY; otherwise, it is marked as FIT FOR DELIVERY.
  • This process repeats for all vehicles, and the full fleet dispatch report is displayed for the entered trip distance.
#include <iostream>
#include <string>
using namespace std;

class MaintenanceCheck {
private:
    string lastCheckDate;
    int kmSinceLastCheck;
    bool passedInspection;

public:
    MaintenanceCheck() {
        lastCheckDate = "N/A";
        kmSinceLastCheck = 0;
        passedInspection = true;
    }

    void input() {
        cout << "Enter last maintenance check date (dd-mm-yyyy): ";
        cin >> lastCheckDate;
        cout << "Enter kilometers driven since last check: ";
        cin >> kmSinceLastCheck;
        char status;
        cout << "Did the vehicle pass the inspection? (y/n): ";
        cin >> status;

        if (status == 'y' || status == 'Y') {
            passedInspection = true;
        } else {
            passedInspection = false;
        }
    }

    bool needsService() const {
        if (!passedInspection || kmSinceLastCheck > 5000) {
            return true;
        } else {
            return false;
        }
    }

    void displayStatus() const {
        cout << "Last Check Date: " << lastCheckDate << "\n";
        cout << "Kilometers Since Last Check: " << kmSinceLastCheck << "\n";
        cout << "Inspection Passed: ";
        if (passedInspection) {
            cout << "Yes\n";
        } else {
            cout << "No\n";
        }
    }
};

class Vehicle {
private:
    string vehicleID;
    string modelName;
    double fuelEfficiency;
    MaintenanceCheck maintenance;

public:
    Vehicle() {
        vehicleID = "";
        modelName = "";
        fuelEfficiency = 0.0;
    }

    void input() {
        cout << "Enter vehicle ID: ";
        cin >> vehicleID;
        cout << "Enter model name: ";
        cin >> modelName;
        cout << "Enter fuel efficiency (km/l): ";
        cin >> fuelEfficiency;
        maintenance.input();
    }

    void displayStatus(double tripDistance) const {
        double fuelRequired = tripDistance / fuelEfficiency;

        cout << "\n--- Vehicle Report ---\n";
        cout << "Vehicle ID: " << vehicleID << "\n";
        cout << "Model Name: " << modelName << "\n";
        cout << "Fuel Efficiency: " << fuelEfficiency << " km/l\n";
        cout << "Trip Distance: " << tripDistance << " km\n";
        cout << "Fuel Required: " << fuelRequired << " liters\n";

        maintenance.displayStatus();

        cout << "Dispatch Status: ";
        if (maintenance.needsService()) {
            cout << "NOT FIT FOR DELIVERY (Service Required)";
        } else {
            cout << "FIT FOR DELIVERY";
        }

        cout << "\n-----------------------\n";
    }
};

int main() {
    int numVehicles;
    double tripDistance;

    cout << "Enter number of vehicles: ";
    cin >> numVehicles;

    if (numVehicles < 1) {
        cout << "Number of vehicles must be at least 1.\n";
        return 1;
    }

    cout << "Enter trip distance (in kilometers): ";
    cin >> tripDistance;

    Vehicle fleet[numVehicles];

    for (int i = 0; i < numVehicles; i++) {
        cout << "\nEnter details for Vehicle " << i + 1 << ":\n";
        fleet[i].input();
    }

    cout << "\n=== Fleet Dispatch Report ===\n";
    for (int i = 0; i < numVehicles; i++) {
        fleet[i].displayStatus(tripDistance);
    }

    return 0;
}

Hospital Appointment and Doctor Scheduling System

A patient is being assigned to Dr. Sara at a hospital counter.
Hospital Reception
You are building an appointment system for a hospital where multiple doctors work in different specialties, such as cardiology or dermatology. Each doctor has a name, a unique ID, a specialty, and a limited number of appointment slots for the day. Patients arrive and request appointments by providing their name, age, and the type of doctor they want to see. Your system should assign each patient to an available doctor of the requested specialty if that doctor still has open slots. If no doctor with that specialty is available, the patient should remain unassigned. In the end, the system must display a report showing which patients were assigned to which doctors, and which patients could not be assigned. Implement this in C++ using two classes: Doctor and Patient, using both default and parameterized constructors, with proper input validation and matching logic.

Test Case 
Input
Enter number of doctors: 3
Enter details for Doctor 1:
Enter Doctor ID: D001
Enter Doctor Name: DrKhan
Enter Specialty: Cardiology
Enter Available Slots: 1
Enter details for Doctor 2:
Enter Doctor ID: D002
Enter Doctor Name: DrSara
Enter Specialty: Dermatology
Enter Available Slots: 2
Enter details for Doctor 3:
Enter Doctor ID: D003
Enter Doctor Name: DrAli
Enter Specialty: Neurology
Enter Available Slots: 1
Enter number of patients: 4
Enter details for Patient 1:
Enter Patient Name: Aisha
Enter Age: 30
Enter Requested Specialty: Dermatology
Enter details for Patient 2:
Enter Patient Name: Bilal
Enter Age: 45
Enter Requested Specialty: Cardiology
Enter details for Patient 3:
Enter Patient Name: Zara
Enter Age: 37
Enter Requested Specialty: Dermatology
Enter details for Patient 4:
Enter Patient Name: Ahmad
Enter Age: 50
Enter Requested Specialty: Cardiology
Expected Output
=== Appointment Report ===
Patient Name: Aisha | Age: 30 | Requested Specialty: Dermatology | Assigned Doctor: DrSara
Patient Name: Bilal | Age: 45 | Requested Specialty: Cardiology | Assigned Doctor: DrKhan
Patient Name: Zara | Age: 37 | Requested Specialty: Dermatology | Assigned Doctor: DrSara
Patient Name: Ahmad | Age: 50 | Requested Specialty: Cardiology | Status: Not Assigned (No available doctor)
  • The program starts by asking the user to enter the number of doctors. This input is saved in the numDoctors variable.
  • An array of Doctor objects is then initialized of size numDoctors. Each Doctor object is initialized using the default constructor.
  • For each doctor, the program prompts the user to enter the doctor’s ID, name, specialty, and the number of available appointment slots. These inputs are collected using a for loop and stored using the input() method of the Doctor class.
  • Next, the program asks the user to enter the number of patients. This value is stored in the numPatients variable, and another array of Patient objects is declared to hold the patient records.
  • For each patient, the program prompts the user to enter the patient’s name, age, and the type of doctor they want to see (specialty). These inputs are collected using a for loop and stored using the input() method of the Patient class.
  • After receiving the patient data, the program attempts to assign a doctor to each patient.
  • For each patient, a nested loop is used to iterate through all doctors. The program checks two conditions: whether the doctor’s specialty matches the patient’s requested specialty, and whether the doctor still has available appointment slots.
  • If both conditions are met, the doctor is assigned to the patient using the assignDoctor() method, and the doctor’s slot count is reduced using the assignSlot() method. A boolean flag assigned is used to track whether a suitable doctor was found.
  • If no doctor is available for the requested specialty, or all such doctors are fully booked, the patient remains unassigned. In such cases, the isAssigned flag in the Patient object remains false.
  • Once all patients have been processed, the program displays an appointment report. For each patient, the program calls the display() method to show their name, age, requested specialty, and either the name of the assigned doctor or a message indicating that no doctor was available.
#include <iostream>
#include <string>
using namespace std;

class Doctor {
private:
    string doctorID;
    string name;
    string specialty;
    int availableSlots;

public:
    Doctor() {
        doctorID = "";
        name = "";
        specialty = "";
        availableSlots = 0;
    }

    Doctor(string id, string n, string s, int slots) {
        doctorID = id;
        name = n;
        specialty = s;
        availableSlots = slots;
    }

    void input() {
        cout << "Enter Doctor ID: ";
        cin >> doctorID;
        cout << "Enter Doctor Name: ";
        cin >> name;
        cout << "Enter Specialty: ";
        cin >> specialty;
        cout << "Enter Available Slots: ";
        cin >> availableSlots;
    }

    string getSpecialty() const {
        return specialty;
    }

    string getName() const {
        return name;
    }

    bool hasAvailableSlot() const {
        return availableSlots > 0;
    }

    void assignSlot() {
        availableSlots--;
    }
};

class Patient {
private:
    string name;
    int age;
    string requestedSpecialty;
    string assignedDoctorName;
    bool isAssigned;

public:
    Patient() {
        name = "";
        age = 0;
        requestedSpecialty = "";
        assignedDoctorName = "";
        isAssigned = false;
    }

    void input() {
        cout << "Enter Patient Name: ";
        cin >> name;
        cout << "Enter Age: ";
        cin >> age;
        cout << "Enter Requested Specialty: ";
        cin >> requestedSpecialty;
    }

    string getRequestedSpecialty() const {
        return requestedSpecialty;
    }

    void assignDoctor(string doctorName) {
        assignedDoctorName = doctorName;
        isAssigned = true;
    }

    void display() const {
        cout << "\nPatient Name: " << name;
        cout << " | Age: " << age;
        cout << " | Requested Specialty: " << requestedSpecialty;
        if (isAssigned) {
            cout << " | Assigned Doctor: " << assignedDoctorName;
        } else {
            cout << " | Status: Not Assigned (No available doctor)";
        }
    }
};

int main() {
    int numDoctors, numPatients;

    cout << "Enter number of doctors: ";
    cin >> numDoctors;

    if (numDoctors < 1) {
        cout << "Invalid number of doctors.\n";
        return 1;
    }

    Doctor doctors[numDoctors];

    for (int i = 0; i < numDoctors; i++) {
        cout << "\nEnter details for Doctor " << i + 1 << ":\n";
        doctors[i].input();
    }

    cout << "\nEnter number of patients: ";
    cin >> numPatients;

    if (numPatients < 1) {
        cout << "Invalid number of patients.\n";
        return 1;
    }

    Patient patients[numPatients];

    for (int i = 0; i < numPatients; i++) {
        cout << "\nEnter details for Patient " << i + 1 << ":\n";
        patients[i].input();

        bool assigned = false;
        for (int j = 0; j < numDoctors; j++) {
            if (doctors[j].getSpecialty() == patients[i].getRequestedSpecialty() &&
                doctors[j].hasAvailableSlot()) {
                patients[i].assignDoctor(doctors[j].getName());
                doctors[j].assignSlot();
                assigned = true;
                break;
            }
        }
    }

    cout << "\n=== Appointment Report ===\n";
    for (int i = 0; i < numPatients; i++) {
        patients[i].display();
        cout << "\n-----------------------------------";
    }

    return 0;
}

Arcade Leaderboard & Player Ranking System

An arcade machine with “Game Over” and gaming items around it.
Arcade Championship
You are designing a comprehensive leaderboard system for an arcade championship where multiple games are available, and players can compete by attempting those games multiple times. Each game has a unique ID, a name, and a defined maximum score that cannot be exceeded in any valid attempt. Players register for the championship and participate by playing different games as many times as they want. Every time a player plays a game, their name, the game ID, and their score are recorded. However, if the submitted score exceeds the maximum allowed for that game, it is considered invalid and ignored. For each valid entry, the system keeps track of only the player’s highest score per game, even if they played the same game multiple times. Once all scores have been recorded, the system evaluates the leaderboard in two dimensions. First, it determines the top player or players for each individual game based on the highest valid score recorded for that game. If multiple players share the same top score in a game, they are all considered top players for that game. Second, the system identifies the overall champion of the arcade championship, the player who has the highest cumulative score across all games they played, based on their highest valid score in each game. If more than one player achieves the same overall top score, they all share the title of overall champion. Write a C++ program that takes this data as input, validates all score entries, tracks each player’s highest valid score per game, and displays the top scorer(s) for each game along with the overall champion based on cumulative best scores.

Test Case 
Input
Enter number of games: 2
Enter details for Game 1:
Enter Game ID: G01
Enter Game Name: SpaceRush
Enter Maximum Score for this game: 500
Enter details for Game 2:
Enter Game ID: G02
Enter Game Name: AlienBlaster
Enter Maximum Score for this game: 300
Enter number of players: 3
Enter name for Player 1: Alice
Enter name for Player 2: Bob
Enter name for Player 3: Charlie
Enter number of score entries: 6
Enter details for Score Entry 1:
Enter Player Name: Alice
Enter Game ID: G01
Enter Score: 450
Enter details for Score Entry 2:
Enter Player Name: Bob
Enter Game ID: G01
Enter Score: 470
Enter details for Score Entry 3:
Enter Player Name: Alice
Enter Game ID: G01
Enter Score: 480
Enter details for Score Entry 4:
Enter Player Name: Bob
Enter Game ID: G02
Enter Score: 290
Enter details for Score Entry 5:
Enter Player Name: Charlie
Enter Game ID: G02
Enter Score: 290
Enter details for Score Entry 6:
Enter Player Name: Alice
Enter Game ID: G02
Enter Score: 310
Score exceeds max score for this game. Entry ignored.
Expected Output
=== Top Player(s) per Game ===
Game: SpaceRush | Top Score: 480
Players: Alice
Game: AlienBlaster | Top Score: 290
Players: Bob Charlie
=== Overall Champion(s) ===
Total Score: 760
Players: Bob
  • The program starts by asking the user to enter the number of games. This input is saved in the numGames variable.
  • For each game, the program prompts the user to enter the game ID, game name, and the maximum score allowed for that game using a loop. These inputs are stored in the games array of Game objects by calling the input() method defined inside the Game class.
  • After the game data is collected, the program asks the user to enter the number of players. This value is saved in the numPlayers variable.
  • For each player, the program asks for the player’s name and stores it using the setName() method in the players array of Player objects. Each player is initialized with default best scores set to -1 for all games.
  • Next, the program asks for the number of score entries to process. This input is stored in the numEntries variable.
  • For each score entry, the user provides the player’s name, game ID, and the score achieved in that attempt. These inputs are stored temporarily in a ScoreEntry object. The program uses helper methods findGameIndex() and findPlayerIndex() to identify the correct indices of the corresponding game and player based on the entered game ID and player name.
  • Before recording a score, the program performs validation. It checks whether the entered score exceeds the maximum allowed score for the selected game.
  • If the score is invalid or the player or game ID does not exist, the entry is ignored.
  • If valid, the program calls the updateScore() method of the corresponding Player object. This method updates the player’s best score for that game only if the new score is higher than any previously recorded score for that game.
  • After all score entries have been processed, the program calculates the total score for each player using the calculateTotalScore() method. This method sums up the best valid score for each game (ignoring -1 values) and stores the result in the player’s totalScore variable.
  • To display the leaderboard, the program loops through all games and determines the highest score achieved in each game by any player.
  • Then, for each game, it identifies all players who achieved that top score and prints their names alongside the game title and top score.
  • If no valid scores were submitted for a game, it prints a message indicating that.
  • Finally, the program determines the overall champion(s) by finding the player(s) with the highest cumulative score across all games. It prints their name(s) along with the total score they achieved, based on their highest valid score in each game they played.
#include <iostream>
#include <string>
using namespace std;

const int MAX_GAMES = 10;
const int MAX_PLAYERS = 20;
const int MAX_ENTRIES = 100;

class Game {
public:
    string gameID;
    string name;
    int maxScore;

    Game() {
        gameID = "";
        name = "";
        maxScore = 0;
    }

    void input() {
        cout << "Enter Game ID: ";
        cin >> gameID;
        cout << "Enter Game Name: ";
        cin >> name;
        cout << "Enter Maximum Score for this game: ";
        cin >> maxScore;
    }
};

class Player {
public:
    string name;
    int bestScores[MAX_GAMES];
    int totalScore;

    Player() {
        name = "";
        for (int i = 0; i < MAX_GAMES; i++)
            bestScores[i] = -1;
        totalScore = 0;
    }

    void setName(string playerName) {
        name = playerName;
    }

    void updateScore(int gameIndex, int score, int maxScore) {
        if (score <= maxScore && score > bestScores[gameIndex]) {
            bestScores[gameIndex] = score;
        }
    }

    void calculateTotalScore() {
        totalScore = 0;
        for (int i = 0; i < MAX_GAMES; i++) {
            if (bestScores[i] >= 0) {
                totalScore += bestScores[i];
            }
        }
    }

    int getBestScore(int gameIndex) const {
        return bestScores[gameIndex];
    }

    int getTotalScore() const {
        return totalScore;
    }

    string getName() const {
        return name;
    }
};

class ScoreEntry {
public:
    string playerName;
    string gameID;
    int score;

    void input() {
        cout << "Enter Player Name: ";
        cin >> playerName;
        cout << "Enter Game ID: ";
        cin >> gameID;
        cout << "Enter Score: ";
        cin >> score;
    }
};

class ArcadeSystem {
private:
    Game games[MAX_GAMES];
    Player players[MAX_PLAYERS];
    int numGames, numPlayers, numEntries;

public:
    void inputGames() {
        cout << "Enter number of games: ";
        cin >> numGames;
        for (int i = 0; i < numGames; i++) {
            cout << "\nEnter details for Game " << i + 1 << ":\n";
            games[i].input();
        }
    }

    void inputPlayers() {
        cout << "\nEnter number of players: ";
        cin >> numPlayers;
        for (int i = 0; i < numPlayers; i++) {
            string name;
            cout << "\nEnter name for Player " << i + 1 << ": ";
            cin >> name;
            players[i].setName(name);
        }
    }

    int findGameIndex(string gameID) {
        for (int i = 0; i < numGames; i++) {
            if (games[i].gameID == gameID)
                return i;
        }
        return -1;
    }

    int findPlayerIndex(string playerName) {
        for (int i = 0; i < numPlayers; i++) {
            if (players[i].getName() == playerName)
                return i;
        }
        return -1;
    }

    void processEntries() {
        cout << "\nEnter number of score entries: ";
        cin >> numEntries;
        for (int i = 0; i < numEntries; i++) {
            ScoreEntry entry;
            cout << "\nEnter details for Score Entry " << i + 1 << ":\n";
            entry.input();

            int gIndex = findGameIndex(entry.gameID);
            int pIndex = findPlayerIndex(entry.playerName);

            if (gIndex == -1 || pIndex == -1) {
                cout << "Invalid game ID or player name. Entry ignored.\n";
                continue;
            }

            if (entry.score > games[gIndex].maxScore) {
                cout << "Score exceeds max score for this game. Entry ignored.\n";
                continue;
            }

            players[pIndex].updateScore(gIndex, entry.score, games[gIndex].maxScore);
        }

        for (int i = 0; i < numPlayers; i++) {
            players[i].calculateTotalScore();
        }
    }

    void displayTopPlayersPerGame() {
        cout << "\n=== Top Player(s) per Game ===\n";
        for (int g = 0; g < numGames; g++) {
            int topScore = -1;
            for (int p = 0; p < numPlayers; p++) {
                if (players[p].getBestScore(g) > topScore) {
                    topScore = players[p].getBestScore(g);
                }
            }

            if (topScore == -1) {
                cout << "\nGame: " << games[g].name << " - No valid scores submitted.\n";
                continue;
            }

            cout << "\nGame: " << games[g].name << " | Top Score: " << topScore << "\nPlayers: ";
            for (int p = 0; p < numPlayers; p++) {
                if (players[p].getBestScore(g) == topScore) {
                    cout << players[p].getName() << "  ";
                }
            }
            cout << endl;
        }
    }

    void displayOverallChampion() {
        int topTotal = -1;
        for (int i = 0; i < numPlayers; i++) {
            if (players[i].getTotalScore() > topTotal) {
                topTotal = players[i].getTotalScore();
            }
        }

        cout << "\n=== Overall Champion(s) ===\nTotal Score: " << topTotal << "\nPlayers: ";
        for (int i = 0; i < numPlayers; i++) {
            if (players[i].getTotalScore() == topTotal) {
                cout << players[i].getName() << "  ";
            }
        }
        cout << endl;
    }

    void run() {
        inputGames();
        inputPlayers();
        processEntries();
        displayTopPlayersPerGame();
        displayOverallChampion();
    }
};

int main() {
    ArcadeSystem arcade;
    arcade.run();
    return 0;
}

Pakistan Air Force Mission Readiness System

a group of soldiers on ground and a jet flying above.
Pakistan Air Force
You are building a system for the Pakistan Air Force to evaluate the performance of pilots through detailed mission simulations. Each mission has multiple phases, like takeoff, combat, evasion, and landing. Every phase includes a list of required maneuvers, a time limit to complete them, and a minimum success ratio (for example, completing at least 80% of the maneuvers correctly within the given time). Each mission also has a unique ID and a difficulty level. Pilots, who belong to different squadrons and hold ranks like Flying Officer or Squadron Leader, attempt these missions and report their performance by listing which maneuvers they succeeded or failed at, and how much time they took in each phase. A phase is passed only if the pilot finishes within the time limit and meets the required success ratio. A mission is only considered fully passed if all its phases are passed. For each fully passed mission, the pilot earns readiness points equal to the mission’s difficulty multiplied by the number of its phases. The system also calculates each pilot’s overall maneuver accuracy across all their attempts. In the end, the system shows the readiness and accuracy of each pilot, finds the top pilot(s) in every squadron, and announces the overall Top Gun of the PAF based on a weighted formula (such as 70% readiness and 30% accuracy). Your program should be written in C++ using at least four classes to handle mission setup, phase requirements, pilot records, and mission attempts. All validation and calculation should be done through class methods, while the main() function should only handle input and reporting.

Test Case 
Input
Enter number of missions: 1
— Mission 1 —
Enter mission ID: M001
Enter mission difficulty (1-10): 5
Enter number of phases: 2
— Phase 1 —
Enter phase name: Takeoff
Enter number of required maneuvers: 2
Enter maneuver 1: engine_check
Enter maneuver 2: climb_out
Enter time limit (in minutes): 3
Enter required success ratio (0 to 1): 1
— Phase 2 —
Enter phase name: Combat
Enter number of required maneuvers: 3
Enter maneuver 1: evasive_roll
Enter maneuver 2: lock_target
Enter maneuver 3: missile_fire
Enter time limit (in minutes): 5
Enter required success ratio (0 to 1): 0.67
Enter number of pilots: 2
— Pilot 1 —
Enter pilot name: Ali
Enter pilot rank: FlyingOfficer
Enter squadron code: SQN21
Enter index of mission to attempt (0 to 0): 0
Pilot Ali attempting mission M001
Attempting phase: Takeoff
Enter time taken (in minutes): 2
Maneuver engine_check (success/fail): success
Maneuver climb_out (success/fail): success
Phase passed.
Attempting phase: Combat
Enter time taken (in minutes): 4
Maneuver evasive_roll (success/fail): success
Maneuver lock_target (success/fail): success
Maneuver missile_fire (success/fail): success
Phase passed.
Mission PASSED. Readiness +10
— Pilot 2 —
Enter pilot name: Hamza
Enter pilot rank: SquadronLeader
Enter squadron code: SQN21
Enter index of mission to attempt (0 to 0): 0
Pilot Hamza attempting mission M001
Attempting phase: Takeoff
Enter time taken (in minutes): 4
Phase failed: Time limit exceeded.
Attempting phase: Combat
Enter time taken (in minutes): 3
Maneuver evasive_roll (success/fail): success
Maneuver lock_target (success/fail): fail
Maneuver missile_fire (success/fail): success
Phase failed: Insufficient success ratio.
Mission FAILED. No readiness gained.
Expected Output
===== Final Report =====
Pilot: Ali | Squadron: SQN21 | Readiness: 10 | Accuracy: 100%
Pilot: Hamza | Squadron: SQN21 | Readiness: 0 | Accuracy: 66.6667%
  • The program starts by asking the user to enter the number of missions. This input is saved in the numMissions variable.
  • For each mission, the program prompts the user to enter the mission ID and its difficulty level using a loop. These inputs are stored in the Mission objects.
  • Each mission also contains multiple phases, so the program asks for the number of phases and collects information for each phase using the input() method of the ManeuverPhase class.
  • In each phase, the user is asked to enter the phase name, the number of required maneuvers, the name of each maneuver, the time limit in minutes, and the required success ratio.
  • The success ratio is validated using a do-while loop to ensure that the value entered lies between 0 and 1. This information is stored inside the ManeuverPhase object, which is then stored in the corresponding Mission.
  • After collecting all mission data, the program asks the user to enter the number of pilots. This input is stored in the numPilots variable. For each pilot, the program collects their name, rank, and squadron code using the input() method of the Pilot class.
  • Next, for each pilot, the program asks which mission they want to attempt by entering an index corresponding to the mission list. The selected mission and pilot are passed to a MissionAttempt object. The program then simulates the mission attempt using the attemptMission() method.
  • Inside the attemptMission() method, each phase of the selected mission is processed one by one. The program displays the phase name and asks the user to input the time taken to complete the phase.
  • If the time taken exceeds the allowed time limit for that phase, the phase is marked as failed and the pilot receives no credit for it.
  • If the time is within the limit, the program then asks the pilot to enter the result (success or fail) for each maneuver. The total number of maneuvers attempted and the number of successful ones are tracked for each pilot.
  • The ratio of successful maneuvers to total maneuvers in the phase is calculated. If this ratio meets or exceeds the phase’s required success ratio, the phase is marked as passed; otherwise, it is failed.
  • If all phases of the mission are passed, the pilot is awarded readiness points. These are calculated by multiplying the mission’s difficulty level with the number of phases. This value is added to the pilot’s readinessPoints variable. If any phase fails, the mission is considered failed and no readiness points are awarded.
  • After all pilots have attempted their missions, the program prints a final report.
  • For each pilot, it displays their name, squadron, total readiness points earned, and overall maneuver accuracy as a percentage. The accuracy is calculated as the ratio of successful maneuvers to total maneuvers attempted across all missions.
#include <iostream>
#include <string>
using namespace std;

const int MAX_PHASES = 5;
const int MAX_MANEUVERS = 10;
const int MAX_MISSIONS = 10;
const int MAX_PILOTS = 10;

class ManeuverPhase {
public:
    string phaseName;
    string requiredManeuvers[MAX_MANEUVERS];
    int totalManeuvers;
    int timeLimit;
    float successRatio;

    ManeuverPhase() {
        phaseName = "";
        totalManeuvers = 0;
        timeLimit = 0;
        successRatio = 0;
    }

    void input() {
        cout << "Enter phase name: ";
        cin >> phaseName;
        cout << "Enter number of required maneuvers: ";
        cin >> totalManeuvers;
        for (int i = 0; i < totalManeuvers; i++) {
            cout << "Enter maneuver " << i + 1 << ": ";
            cin >> requiredManeuvers[i];
        }
        cout << "Enter time limit (in minutes): ";
        cin >> timeLimit;
        do {
            cout << "Enter required success ratio (0 to 1): ";
            cin >> successRatio;
            if (successRatio < 0 || successRatio > 1) {
                cout << "Invalid ratio. Please enter a value between 0 and 1.\n";
            }
        } while (successRatio < 0 || successRatio > 1);
    }
};

class Mission {
public:
    string missionID;
    int difficulty;
    ManeuverPhase phases[MAX_PHASES];
    int numPhases;

    void input() {
        cout << "Enter mission ID: ";
        cin >> missionID;
        cout << "Enter mission difficulty (1-10): ";
        cin >> difficulty;
        cout << "Enter number of phases: ";
        cin >> numPhases;
        for (int i = 0; i < numPhases; i++) {
            cout << "\n--- Phase " << i + 1 << " ---\n";
            phases[i].input();
        }
    }
};

class Pilot {
public:
    string name, rank, squadron;
    int readinessPoints;
    int totalManeuvers;
    int successfulManeuvers;

    Pilot() {
        readinessPoints = 0;
        totalManeuvers = 0;
        successfulManeuvers = 0;
    }

    void input() {
        cout << "Enter pilot name: ";
        cin >> name;
        cout << "Enter pilot rank: ";
        cin >> rank;
        cout << "Enter squadron code: ";
        cin >> squadron;
    }

    float getAccuracy() const {
        if (totalManeuvers == 0) return 0;
        return (float)successfulManeuvers / totalManeuvers;
    }
};

class MissionAttempt {
public:
    Pilot* pilot;
    Mission* mission;

    bool attemptPhase(const ManeuverPhase& phase) {
        int timeTaken, successful = 0;
        cout << "\nAttempting phase: " << phase.phaseName << endl;
        cout << "Enter time taken (in minutes): ";
        cin >> timeTaken;

        if (timeTaken > phase.timeLimit) {
            cout << "Phase failed: Time limit exceeded." << endl;
            return false;
        }

        for (int i = 0; i < phase.totalManeuvers; i++) {
            string status;
            cout << "Maneuver " << phase.requiredManeuvers[i] << " (success/fail): ";
            cin >> status;
            pilot->totalManeuvers++;
            if (status == "success") pilot->successfulManeuvers++, successful++;
        }

        float ratio = (float)successful / phase.totalManeuvers;
        if (ratio >= phase.successRatio) {
            cout << "Phase passed.\n";
            return true;
        } else {
            cout << "Phase failed: Insufficient success ratio.\n";
            return false;
        }
    }

    void attemptMission() {
        cout << "\nPilot " << pilot->name << " attempting mission " << mission->missionID << "\n";
        bool allPassed = true;
        for (int i = 0; i < mission->numPhases; i++) {
            if (!attemptPhase(mission->phases[i])) {
                allPassed = false;
            }
        }
        if (allPassed) {
            int gained = mission->difficulty * mission->numPhases;
            pilot->readinessPoints += gained;
            cout << "Mission PASSED. Readiness +" << gained << "\n";
        } else {
            cout << "Mission FAILED. No readiness gained.\n";
        }
    }
};

int main() {
    int numMissions, numPilots;
    Mission missions[MAX_MISSIONS];
    Pilot pilots[MAX_PILOTS];

    cout << "Enter number of missions: ";
    cin >> numMissions;
    for (int i = 0; i < numMissions; i++) {
        cout << "\n--- Mission " << i + 1 << " ---\n";
        missions[i].input();
    }

    cout << "\nEnter number of pilots: ";
    cin >> numPilots;
    for (int i = 0; i < numPilots; i++) {
        cout << "\n--- Pilot " << i + 1 << " ---\n";
        pilots[i].input();
        int missionIndex;
        cout << "Enter index of mission to attempt (0 to " << numMissions - 1 << "): ";
        cin >> missionIndex;
        MissionAttempt attempt;
        attempt.pilot = &pilots[i];
        attempt.mission = &missions[missionIndex];
        attempt.attemptMission();
    }

    cout << "\n===== Final Report =====\n";
    for (int i = 0; i < numPilots; i++) {
        cout << "Pilot: " << pilots[i].name << " | Squadron: " << pilots[i].squadron
             << " | Readiness: " << pilots[i].readinessPoints
             << " | Accuracy: " << pilots[i].getAccuracy() * 100 << "%\n";
    }

    return 0;
}

National Disaster Response Coordination Simulator

Icons of natural disasters with a message to make smart choices.
Natural Disasters
You are building a simulation system for National Disaster Management Authority (NDMA) to test how well regional coordinators manage disaster response operations. Each coordinator is placed into three simulated natural disaster scenarios such as floods, earthquakes, or wildfires. Every scenario includes key factors: the disaster type, severity level (mild, moderate, or critical), the affected population, and the level of accessibility (easy, partial, or blocked). Based on these conditions, the coordinator must choose a deployment strategy (light, balanced, or aggressive), a response priority (communication, evacuation, or relief), and decide when to request military support (early, late, or none). Each decision is scored to evaluate its impact on three critical dimensions: mission success, efficiency, and public confidence. The success score depends on how well the chosen strategy aligns with the disaster’s severity. In critical cases, aggressive deployment adds +40 points, balanced adds +30, and light adds +20. If the area is blocked and the coordinator prioritizes evacuation, -10 points are deducted for poor judgment. Additionally, requesting military support early adds +20 points. In moderate scenarios, balanced deployment yields +35, aggressive +25, and light +20, with a -5 penalty if no military support is requested. In mild cases, light deployment gives +30, while balanced or aggressive gives only +20. The confidence score reflects how reassuring the response appears to the public. Prioritizing communication adds +30 points, evacuation adds +25, and relief adds +20. The efficiency score measures resource usage. Light deployment, being most conservative, earns +40; balanced earns +30; aggressive earns only +20 due to high resource consumption. Each scenario calculates these three scores based on the coordinator’s choices. After all three simulations are completed, average scores are calculated for success, efficiency, and confidence. The final overall effectiveness score is computed using the formula: Effectiveness = (0.5 × average success) + (0.3 × average efficiency) + (0.2 × average confidence). Your task is to implement this system in C++. Define classes for the disaster scenario, response plan, coordinator, and simulation system. All scoring logic must be encapsulated in class methods. At the end, display a full report showing each coordinator’s average scores and their total effectiveness rating based on the decisions made across all three disaster scenarios.

Test Case 
Input
Enter coordinator name: Sana
Enter region: NorthZone
— Scenario 1 —
Enter disaster type (flood/earthquake/etc.): flood
Enter severity level (mild/moderate/critical): critical
Enter affected population: 25000
Enter accessibility (easy/blocked/partial): blocked
Deployment strategy (light/balanced/aggressive): aggressive
Response priority (communication/evacuation/relief): evacuation
Military support (early/late/none): early

— Scenario 2 —
Enter disaster type (flood/earthquake/etc.): earthquake
Enter severity level (mild/moderate/critical): moderate
Enter affected population: 12000
Enter accessibility (easy/blocked/partial): partial
Deployment strategy (light/balanced/aggressive): balanced
Response priority (communication/evacuation/relief): communication
Military support (early/late/none): none

— Scenario 3 —
Enter disaster type (flood/earthquake/etc.): wildfire
Enter severity level (mild/moderate/critical): mild
Enter affected population: 5000
Enter accessibility (easy/blocked/partial): easy
Deployment strategy (light/balanced/aggressive): light
Response priority (communication/evacuation/relief): relief
Military support (early/late/none): late

Expected Output
— Scenario Outcome —
Success Score: 50
Efficiency Score: 20
Confidence Score: 25

— Scenario Outcome —
Success Score: 30
Efficiency Score: 30
Confidence Score: 30

— Scenario Outcome —
Success Score: 30
Efficiency Score: 40
Confidence Score: 20

===== Final Report for Sana =====
Average Success: 36.6667
Average Efficiency: 30
Average Confidence: 25
Overall Effectiveness Score: 32.3333
  • The program starts by asking the user to enter the coordinator’s name and their region. These inputs are saved in the coordinatorName and regionName variables within the Coordinator class.
  • The simulation then runs a total of three times using a for loop, where each iteration represents a new disaster scenario.
  • For every scenario, the program asks the user to enter the type of disaster, its severity level (which must be either “mild”, “moderate”, or “critical”), the number of people affected (which must be greater than zero), and the current accessibility of the disaster area (which must be either “easy”, “blocked”, or “partial”). These values are stored in the DisasterScenario class variables. The inputs for severity and accessibility are validated using do-while loops to ensure only valid values are accepted.
  • After the scenario details are entered, the program prompts the user to define a response plan by selecting a deployment strategy (either “light”, “balanced”, or “aggressive”), a response priority (either “communication”, “evacuation”, or “relief”), and the timing of military support (either “early”, “late”, or “none”). These values are stored in the ResponsePlan class, and are also validated using do-while loops to ensure correct and expected inputs.
  • Once all inputs for the scenario and response plan are provided, the program moves into the runScenario() method in the SimulationSystem class. This method evaluates the response by calculating three performance scores: success, efficiency, and confidence.
  • The success score is calculated based on the severity level and how appropriate the response decisions are.
  • If the severity is critical, then:
    • “aggressive” deployment gives +40 points,
    • “balanced” gives +30,
    • “light” gives +20.
    • Additionally, if the area is “blocked” and the coordinator chose “evacuation” as the priority, −10 points are subtracted due to poor decision-making.
    • If military support is requested early, +20 points are added.
  • If the severity is moderate, then:
    • “balanced” deployment earns +35 points,
    • “aggressive” earns +25,
    • “light” earns +20.
    • Choosing to request no military support in this case results in a −5 point penalty.
  • If the severity is mild, then:
    • “light” deployment earns +30 points,
    • any other strategy earns +20.
  • The confidence score is calculated based on the selected response priority:
    • Choosing “communication” adds +30 points,
    • “evacuation” adds +25 points,
    • and “relief” adds +20 points.
  • The efficiency score is determined by how resource-intensive the deployment strategy is:
    • “light” earns +40 points for being most efficient,
    • “balanced” earns +30,
    • “aggressive” earns only +20 due to high resource usage.
  • All three scores (success, efficiency, and confidence) are added to the coordinator’s cumulative totals using the accumulatedSuccess, accumulatedEfficiency, and accumulatedConfidence variables.
  • This entire process repeats for three scenarios. After all scenarios are completed, the program calls the showFinalReport() method to evaluate the coordinator’s performance. It calculates the average of each score by dividing the accumulated totals by 3. Then, it calculates a final weighted effectiveness score using the formula: Effectiveness=(0.5×Average Success)+(0.3×Average Efficiency)+(0.2×Average Confidence).
  • Finally, the program displays a detailed report showing the coordinator’s name, average scores for success, efficiency, and confidence, and the final effectiveness score.
#include <iostream>
#include <string>
using namespace std;

class DisasterScenario {
public:
    string disasterType;
    string severityLevel;
    int affectedPopulation;
    string areaAccessibility;

    void input() {
        cout << "Enter disaster type (flood/earthquake/etc.): ";
        cin >> disasterType;

        do {
            cout << "Enter severity level (mild/moderate/critical): ";
            cin >> severityLevel;
        } while (!(severityLevel == "mild" || severityLevel == "moderate" || severityLevel == "critical"));

        do {
            cout << "Enter affected population: ";
            cin >> affectedPopulation;
        } while (affectedPopulation <= 0);

        do {
            cout << "Enter accessibility (easy/blocked/partial): ";
            cin >> areaAccessibility;
        } while (!(areaAccessibility == "easy" || areaAccessibility == "blocked" || areaAccessibility == "partial"));
    }
};

class ResponsePlan {
public:
    string deploymentStrategy;
    string responsePriority;
    string militaryRequestTiming;

    void input() {
        do {
            cout << "Deployment strategy (light/balanced/aggressive): ";
            cin >> deploymentStrategy;
        } while (!(deploymentStrategy == "light" || deploymentStrategy == "balanced" || deploymentStrategy == "aggressive"));

        do {
            cout << "Response priority (communication/evacuation/relief): ";
            cin >> responsePriority;
        } while (!(responsePriority == "communication" || responsePriority == "evacuation" || responsePriority == "relief"));

        do {
            cout << "Military support (early/late/none): ";
            cin >> militaryRequestTiming;
        } while (!(militaryRequestTiming == "early" || militaryRequestTiming == "late" || militaryRequestTiming == "none"));
    }
};

class Coordinator {
public:
    string coordinatorName;
    string regionName;
    float accumulatedSuccess;
    float accumulatedEfficiency;
    float accumulatedConfidence;

    Coordinator() {
        accumulatedSuccess = 0;
        accumulatedEfficiency = 0;
        accumulatedConfidence = 0;
    }

    void input() {
        cout << "Enter coordinator name: ";
        cin >> coordinatorName;
        cout << "Enter region: ";
        cin >> regionName;
    }
};

class SimulationSystem {
public:
    void runScenario(DisasterScenario &scenario, ResponsePlan &plan, Coordinator &coordinator) {
        float successScore = 0, efficiencyScore = 0, confidenceScore = 0;

        if (scenario.severityLevel == "critical") {
            if (plan.deploymentStrategy == "aggressive") successScore += 40;
            else if (plan.deploymentStrategy == "balanced") successScore += 30;
            else successScore += 20;

            if (scenario.areaAccessibility == "blocked" && plan.responsePriority == "evacuation") successScore -= 10;

            if (plan.militaryRequestTiming == "early") successScore += 20;
        }
        else if (scenario.severityLevel == "moderate") {
            if (plan.deploymentStrategy == "balanced") successScore += 35;
            else if (plan.deploymentStrategy == "aggressive") successScore += 25;
            else successScore += 20;

            if (plan.militaryRequestTiming == "none") successScore -= 5;
        }
        else {
            if (plan.deploymentStrategy == "light") successScore += 30;
            else successScore += 20;
        }

        if (plan.responsePriority == "communication") confidenceScore += 30;
        else if (plan.responsePriority == "relief") confidenceScore += 20;
        else confidenceScore += 25;

        if (plan.deploymentStrategy == "aggressive") efficiencyScore += 20;
        else if (plan.deploymentStrategy == "balanced") efficiencyScore += 30;
        else efficiencyScore += 40;

        coordinator.accumulatedSuccess += successScore;
        coordinator.accumulatedEfficiency += efficiencyScore;
        coordinator.accumulatedConfidence += confidenceScore;

        cout << "\n--- Scenario Outcome ---\n";
        cout << "Success Score: " << successScore << endl;
        cout << "Efficiency Score: " << efficiencyScore << endl;
        cout << "Confidence Score: " << confidenceScore << endl;
    }

    void showFinalReport(Coordinator &coordinator, int totalScenarios) {
        float avgSuccess = coordinator.accumulatedSuccess / totalScenarios;
        float avgEfficiency = coordinator.accumulatedEfficiency / totalScenarios;
        float avgConfidence = coordinator.accumulatedConfidence / totalScenarios;

        float weightedEffectiveness = (avgSuccess * 0.5) + (avgEfficiency * 0.3) + (avgConfidence * 0.2);

        cout << "\n===== Final Report for " << coordinator.coordinatorName << " =====" << endl;
        cout << "Average Success: " << avgSuccess << endl;
        cout << "Average Efficiency: " << avgEfficiency << endl;
        cout << "Average Confidence: " << avgConfidence << endl;
        cout << "Overall Effectiveness Score: " << weightedEffectiveness << endl;
    }
};

int main() {
    Coordinator coordinator;
    DisasterScenario scenario;
    ResponsePlan plan;
    SimulationSystem simulator;

    coordinator.input();

    for (int i = 1; i <= 3; i++) {
        cout << "\n--- Scenario " << i << " ---" << endl;
        scenario.input();
        plan.input();
        simulator.runScenario(scenario, plan, coordinator);
    }

    simulator.showFinalReport(coordinator, 3);

    return 0;
}

Leave a Comment

Your email address will not be published. Required fields are marked *

Scroll to Top