Question: C + + Programming Days Out Write a program that calculates the average number of days a company's employees are absent . The program should
C Programming
Days Out
Write a program that calculates 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 argu
ments.
A function called by main that accepts one argument: the number of employees in
the company. The function should ask the user to enter the number of days each
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 average number of days absentThis
function does not perform screen output and does not ask the user for input.
Input Validation: Do not accept a number less than for the number of employees. Do
not accept a negative number for the days any employee missed.
Also include the Following
The function that asks for the number of employees and returns it should be named
empTotal
The function that calculates and returns the total of days missed by all employees
should be named daysTotal
The function that calculates and returns the average number of days missed should
be named daysAverage.
In the function that calculates the total of days missed by all employees daysTotal
the function should also display the count of employees, total days missed by all
employees and highest and lowest count of days missed. The only value returned by
the function should be the total of days missed by all employees.
All validations are to be done in each respective function. No separate validation
function must be included.
use the following template
#include
using namespace std;
prototypes of functions to be included in the program
int empTotal;
int daysTotalint;
double daysAverageint int;
int main
declaration of variables to be used in main
calling funtions
Call the empTotal function to accept and return the count of employees
Call the daysTotal function to accept and return the total of days missed by all employees
Call the daysAverage function by passing to it the count of employees and total of days missed by all employees
avgDays daysAverageeTotal dTotal;
display of average days missed by asll employees
cout "Average days missed daysAverage endl;
systempause;
return ;
Declaration of functions used in the program
Function to input total count of employees
int empTotal
return empCount;
creating a loop for user input and diplays high and low and returns total # of days
int daysTotalint empTotal
Calculate total days missed by all employees and figure out highest and lowest days missed by them
Display of information
cout endl endl;
cout "Total count of employees empTotal endl;
cout "Total days missed by all employees daysTotal endl;
cout "Highest number of days missed are highest endl;
cout "Lowest number of days missed are lowest endl endl;
cout endl;
return total days missed by all employees
return daysTotal;
Declare the function to calculate the average of days missed by passing to it the count of employees and total of days missed by all employees
double daysAverageint empCount, int daysTotal
return avgDays;
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
