Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

13. 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:

13. 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 arguments.)

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 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 any employee missed.

use the supplied program template, include modifications as below.

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.

// // Brief Program description // One easy concept // One challenging concept #include  using namespace std; // prototypes of functions to be included in the program int empTotal(); int daysTotal(int); double daysAverage(int, 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 = daysAverage(eTotal, dTotal); // display of average days missed by asll employees cout << "Average days missed = " << days_Average << endl; system("pause"); return 0; } //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 daysTotal(int 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 daysAverage(int empCount, int daysTotal) { return avgDays; } 

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Joe Celkos Data And Databases Concepts In Practice

Authors: Joe Celko

1st Edition

1558604324, 978-1558604322

Students also viewed these Databases questions

Question

Describe six biases affecting perception.

Answered: 1 week ago

Question

3. What information do participants need?

Answered: 1 week ago