#include <iostream>
#include <vector>
#include <iomanip>
class Employee {
public:
Employee(const std::string& name, const std::vector<double>& performanceScores)
: name(name), performanceScores(performanceScores) {}
std::string getName() const { return name; }
double getAverageScore() const {
double sum = 0;
for (double score : performanceScores) {
sum += score;
}
return performanceScores.empty() ? 0 : sum / performanceScores.size();
}
private:
std::string name;
std::vector<double> performanceScores;
};
int main() {
int numEmployees;
std::cout << "Enter the number of employees: ";
std::cin >> numEmployees;
std::vector<Employee> employees;
for (int i = 0; i < numEmployees; ++i) {
std::string name;
int numCriteria;
std::cout << "Enter name for employee " << i + 1 << ": ";
std::cin.ignore(); // To ignore any newline character left in the buffer
std::getline(std::cin, name);
std::cout << "Enter the number of performance criteria for " << name << ": ";
std::cin >> numCriteria;
std::vector<double> performanceScores(numCriteria);
for (int j = 0; j < numCriteria; ++j) {
std::cout << "Enter score for criterion " << j + 1 << ": ";
std::cin >> performanceScores[j];
}
employees.emplace_back(name, performanceScores);
}
std::cout << std::fixed << std::setprecision(2);
std::cout << "\nEmployee Performance Report:\n";
std::cout << "Name\tAverage Score\n";
for (const auto& employee : employees) {
std::cout << employee.getName() << "\t" << employee.getAverageScore() << "\n";
}
return 0;
}