c++ plz include explanation in // format . thnx
Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
Related questions
Question
c++
plz include explanation in // format .
thnx
![Write a program that calculates the average number of days a company's employees are
absent during the year and outputs a report on a file named "employeeAbsences.txt".
Project Specifications
Input for this project:
• the user must enter the number of employees in the company.
• the user must enter as integers for each employee:
o the employee number (ID)
o the number of days that employee missed during the past year.
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.
Be sure to print appropriate error messages for these items if the input is
invalid.
Output: The program should display the following data:
• display a user full name
display a due date
• display the user full name
Each employee number (ID) and the number of days missed should be written
to the report file named "employeeAbsences.txt".
• The average number of days a company's employees are absenting during the
year should be written to the report file named "employeeAbsences.txt".
Processing Requirements
Create a global variable of type ofstream for the output file. Use this variable to
open the file employeeAbsences.txt in your program to write data to it. A global
variable is defined above the main function and its scope is within the entire program.
Create the following three functions that will be called by the main function:
1. A function called NumofEmplovees. This function asks the user for the number
of employees in the company. This value should be returned as an int. The
function accepts no arguments (No parameter/input).
2. A second function called TotDaysAbsent that accepts an arguments of type
int for the number of employees in the company and returns the total of
missed days as an int. This function should do the following:
a. Asks the user to enter the following information for each employee:
The employee number (ID) (Assume the employee number is 4 digits
or fewer, but don't validate it).
The number of days that employee missed during the past year.](/v2/_next/image?url=https%3A%2F%2Fcontent.bartleby.com%2Fqna-images%2Fquestion%2Fff4c0d41-977e-42ac-8b02-1898edfb1ca9%2F275fe2aa-6aa4-4413-8613-b48fd4513623%2Foe0o8mf_processed.jpeg&w=3840&q=75)
Transcribed Image Text:Write a program that calculates the average number of days a company's employees are
absent during the year and outputs a report on a file named "employeeAbsences.txt".
Project Specifications
Input for this project:
• the user must enter the number of employees in the company.
• the user must enter as integers for each employee:
o the employee number (ID)
o the number of days that employee missed during the past year.
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.
Be sure to print appropriate error messages for these items if the input is
invalid.
Output: The program should display the following data:
• display a user full name
display a due date
• display the user full name
Each employee number (ID) and the number of days missed should be written
to the report file named "employeeAbsences.txt".
• The average number of days a company's employees are absenting during the
year should be written to the report file named "employeeAbsences.txt".
Processing Requirements
Create a global variable of type ofstream for the output file. Use this variable to
open the file employeeAbsences.txt in your program to write data to it. A global
variable is defined above the main function and its scope is within the entire program.
Create the following three functions that will be called by the main function:
1. A function called NumofEmplovees. This function asks the user for the number
of employees in the company. This value should be returned as an int. The
function accepts no arguments (No parameter/input).
2. A second function called TotDaysAbsent that accepts an arguments of type
int for the number of employees in the company and returns the total of
missed days as an int. This function should do the following:
a. Asks the user to enter the following information for each employee:
The employee number (ID) (Assume the employee number is 4 digits
or fewer, but don't validate it).
The number of days that employee missed during the past year.
![b. Writes each employee number (ID) and the number of days missed to the
output file (employeeAbsences.txt). ( Refer to Sample File Output )
3. A third function called AverageAbsent that calculates the average number of
days absent.
a. The function takes two arguments:
• the number of employees in the company
• The total number of days absent for all employees during the year.
b. This function should return, as a double, the average number of days
absent.
c. This function does not perform screen or file output and does not ask the
user for input.
Sample Screen Output:
| Mark C\windows\system32\cmd.exe
Calculate the average nunber of days a conpany's enployees are absent.
Please enter the nunber of enplo yees in the conpany: 5
Please enter an enployee ID: 1234
Please enter the nunber of days this enployee vas absent: 3
Please enter an enployee ID: 22
Please enter the nunber of days this enployee was absent: 8
Please enter an enployee ID: 667
Please enter the nunber of days this enployee was absent: -5
The nunber of days nust not be negative.
Please re-enter the nunber of days absent: 5
Please enter an enployee ID: 4
Please enter the nunber of days this enployee was absent: 11
Please enter an enployee ID: 9876
Please enter the nunber of days this enployee was absent: 1
Progranner:
Press any key to continue .
insert your nane here
Sample File Output format:
employeeAbsences.bxt + x daysOut.cpp
EMPLOYEE ABSENCE REPORT
days absent
employee id
1234
22
667
5
4
11
9876
1
The 5 employees were absent a total of 20 days.
The average number of days absent is 4.0 days.
Programmer:
insert your name here](/v2/_next/image?url=https%3A%2F%2Fcontent.bartleby.com%2Fqna-images%2Fquestion%2Fff4c0d41-977e-42ac-8b02-1898edfb1ca9%2F275fe2aa-6aa4-4413-8613-b48fd4513623%2F47xv7z_processed.jpeg&w=3840&q=75)
Transcribed Image Text:b. Writes each employee number (ID) and the number of days missed to the
output file (employeeAbsences.txt). ( Refer to Sample File Output )
3. A third function called AverageAbsent that calculates the average number of
days absent.
a. The function takes two arguments:
• the number of employees in the company
• The total number of days absent for all employees during the year.
b. This function should return, as a double, the average number of days
absent.
c. This function does not perform screen or file output and does not ask the
user for input.
Sample Screen Output:
| Mark C\windows\system32\cmd.exe
Calculate the average nunber of days a conpany's enployees are absent.
Please enter the nunber of enplo yees in the conpany: 5
Please enter an enployee ID: 1234
Please enter the nunber of days this enployee vas absent: 3
Please enter an enployee ID: 22
Please enter the nunber of days this enployee was absent: 8
Please enter an enployee ID: 667
Please enter the nunber of days this enployee was absent: -5
The nunber of days nust not be negative.
Please re-enter the nunber of days absent: 5
Please enter an enployee ID: 4
Please enter the nunber of days this enployee was absent: 11
Please enter an enployee ID: 9876
Please enter the nunber of days this enployee was absent: 1
Progranner:
Press any key to continue .
insert your nane here
Sample File Output format:
employeeAbsences.bxt + x daysOut.cpp
EMPLOYEE ABSENCE REPORT
days absent
employee id
1234
22
667
5
4
11
9876
1
The 5 employees were absent a total of 20 days.
The average number of days absent is 4.0 days.
Programmer:
insert your name here
Expert Solution
![](/static/compass_v2/shared-icons/check-mark.png)
This question has been solved!
Explore an expertly crafted, step-by-step solution for a thorough understanding of key concepts.
This is a popular solution!
Trending now
This is a popular solution!
Step by step
Solved in 2 steps
![Blurred answer](/static/compass_v2/solution-images/blurred-answer.jpg)
Knowledge Booster
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.Recommended textbooks for you
![Database System Concepts](https://www.bartleby.com/isbn_cover_images/9780078022159/9780078022159_smallCoverImage.jpg)
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
![Starting Out with Python (4th Edition)](https://www.bartleby.com/isbn_cover_images/9780134444321/9780134444321_smallCoverImage.gif)
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
![Digital Fundamentals (11th Edition)](https://www.bartleby.com/isbn_cover_images/9780132737968/9780132737968_smallCoverImage.gif)
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
![Database System Concepts](https://www.bartleby.com/isbn_cover_images/9780078022159/9780078022159_smallCoverImage.jpg)
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
![Starting Out with Python (4th Edition)](https://www.bartleby.com/isbn_cover_images/9780134444321/9780134444321_smallCoverImage.gif)
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
![Digital Fundamentals (11th Edition)](https://www.bartleby.com/isbn_cover_images/9780132737968/9780132737968_smallCoverImage.gif)
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
![C How to Program (8th Edition)](https://www.bartleby.com/isbn_cover_images/9780133976892/9780133976892_smallCoverImage.gif)
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
![Database Systems: Design, Implementation, & Manag…](https://www.bartleby.com/isbn_cover_images/9781337627900/9781337627900_smallCoverImage.gif)
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
![Programmable Logic Controllers](https://www.bartleby.com/isbn_cover_images/9780073373843/9780073373843_smallCoverImage.gif)
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education