This is a program I have to do for class and just wanted to get some feedback. Comments and critiques welcomed.

-------------

This program will calculate and display the average number of days a company's employees are absent. The program should have the following functions.

A function called by main that asks the user for the number of employees in the company. This value should be returned as an int. (The function accepts no arguments.)

A function called by main that accepts one arument, the number of employees in the company. The function should ask the user to enter the number of days eache employee missed during the past year. The total of these days should be returned as an int.

A function called by main that takes two arguments, the number of employees in the company and the total number of days absent for all employees during the year. The function should return, as a double, the averae number of days absent. (This function does not perform screen output and does not ask the user for input.)

Input validation: Do not accept a number less than 1 for the number of employees. Do not accept a negative number for the days an employee missed.

Code://This program calculates and displays the average number of days a company's employees are absent //written by: XXXXX XXXX //CS 241 //Exercise #1 //Due Date: January 29, 2008 #include <iostream> #include <iomanip> using namespace std; //Function Prototypes int num_Employees(); int daysMissed(int); double calc_daysAbsent(int, int); int main() { int numEmployees, total_missedDays; double absentAverage; cout <<"This program calculates and displays the average number of days a company's" << endl; cout <<"employees are absent." << endl; numEmployees = num_Employees(); total_missedDays = daysMissed(numEmployees); absentAverage = calc_daysAbsent(numEmployees, total_missedDays); cout <<"The average number of days " << numEmployees << " employee(s) missed is " << absentAverage <<"." << endl; system("pause"); return 0; } //************************************************************ //Definition of function calc_daysAbsent. * //This function calculates the average number of days absent * //************************************************************ double calc_daysAbsent(int numEmployees, int total_missedDays) { double absentAverage; absentAverage = total_missedDays/numEmployees; return absentAverage; } //**************************************************************************************************** //Definition of function daysMissed. * //This function asks the user to enter the number of days each employee missed during the past year. * //**************************************************************************************************** int daysMissed(int numEmployees) { int count, total_missedDays, sum = 0; for(count = 1; count <= numEmployees; count++) { cout <<"How many days were missed by employee " << count << "?" << endl; cin >> total_missedDays; while(total_missedDays < 0) //test to see if inputed information is valid { cout << total_missedDays << " is invalid. Please enter a non-negative number." << endl; cout <<"How many days were missed by employee " << count << "?" << endl; cin >> total_missedDays; } sum += total_missedDays; } return sum; } //****************************************************************************** //Definition of function numEmployees. * //This function asks the user for the number of employees in the company. * //****************************************************************************** int num_Employees() { int numEmployees; cout <<"Please enter the number of employees in the company." << endl; cin >> numEmployees; while(numEmployees < 1) // checks to see if the number of employees in the company is less than 1 // if less than one, it continues the loop until it becomes valid { cout << numEmployees << " is invalid. The number of employees must be greater than 0." << endl; cout <<"Please enter the number of employees in the company." << endl; cin >> numEmployees; } return numEmployees; }