Exemple #1
0
int main(void)
{
    double average;
    Employee workers[SIZE];

    if (!(fp = fopen("payfile.txt", "r"))) {
        printf("payfile.txt could not be opened for input.");
        exit(1);
    }
    if (!(csis = fopen("csis.txt", "w"))) {
        printf("csis.txt could not be opened for output.");
        exit(1);
    }

    getEmployees(workers);
    showEmployees(workers);
    males(workers);
    highestFemale(workers);
    lowestMale(workers);
    average = averageSalary(workers);
    femalesUnderAverage(workers, average);
    maleRatio(workers, average);
    superEmployee(workers);
    setRaise(workers);

    fclose(fp);
    fclose(csis);

    return 0;
}
/**
 * @brief Gets an employee from our list with a given ID
 * @param id ID to use to get the Employee with
 * @return Employee object from the ID
 */
Employee DataInterface::getEmployeeFromID(int id)
{
    //Loop through our employees for one with the matching id
    Employee retEmployee;
    foreach(Employee e, getEmployees())
    {
        if(e.getID() == id)
        {
            retEmployee = e;
            break;
        }

    }
    //Return that employee or NULL if there aren't any
    return retEmployee;
}