Question
Actually, I am trying to upload the picture but it dosen't work as well. In this programm i should open a file name lab2data.txt and
Actually, I am trying to upload the picture but it dosen't work as well.
In this programm i should open a file name lab2data.txt and it contains : first_name, last_name, salary, gender.
The language should be either Eclipse or Dev C++.
This is the explanation for this programm:
We are given a data file from a company containing all their employee names, salary, and gender. We are to process the data and display gender and salary statistics.
File format (each field separated by a tab):
First row is a header row
All other rows:
first_name last_name salary gender
Safe assumptions to make No spaces will be in the file, only tabs. (No last names have more than one word)
Gender will be only Female or Male
You do not need to STORE the entire file in memory, process each line and forget the details that do not matter, such as employees name.
Your code should work for any data that follows the formatting rules File may contain MORE then 1000 records, perhaps millions
File name may be hard coded, however, do not add any path info After reading in and processing the data:
Output the number of employees found, the number of females, and the number of males. Output the average total salary, average female salary, and the average male salary.
Finally, the output would be:
Total Persons: 1000
Total Females: 486
Total Males: 514
Average Salary for all: $105230
Average Salary for Females: $108097
Average Salary for Males: $102519
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started