Question: In C + + , This program is going to make use of structured data. You are to come up with two structures; one for
In C This program is going to make use of structured data. You are to come up with two structures; one for an employee and one for a department. You must incorporate some kind of nested structure into your program. The goal of this program is to read a text file that is comma separated. The following fields will be in the text file: social security number, first name, last name, middle initial, city, state, age, gender, department id department name, building letter, building floor, and department phone number. You are to read these fields into an array made of your structure. Use what you know to your advantage; we know that there are a set number of columns and we know that each column is separated by a comma. It is crucial that this is dynamic, I will be testing your program against different text files to ensure that this is dynamic. Once the information is read in we will be able to perform some manipulation on the data. We will display a menu that has the following options: Display all employees, display the name of the oldest employee, display the building letter and floor for the computer science department, display all department names who are in building A find an employee and list their information, and average age of employees who live in Michigan. Once one of these options is selected the screen will clear and the result will show. At this point the user will be able to enter in to display the menu options again or to exit the program. It is important to note that some of the menu options could show duplicate results, I do not want you to show duplicates EG if more than one person works in a department in building A we would list that department more than once. We do not want this. You are not allowed to use any prebuilt functions to parse the data EG istringstream you must come up with your own algorithm for this.
Notes:
You must incorporate at least two functions. However, I highly recommend that you use more than two.
Be careful reading in fields that have spaces.
Be sure to know what value is being stored in what type of variable. You will most likely read everything in as a string. However, I want you to do math with ages so that needs to be stored as an integer.
You are allowed to make a global structure but that is the only global variable that you are allowed to use. NOTE: I am talking about the structure not the array
This must be dynamic, so looking at the text file and seeing the number of entries in my text file and making an array that large will not work.
There should be error checking on your menu options Dont worry about if the user inputs a string, we just want a valid menu selection
There will always be the same number of columns
The columns will always be in the same order
You can use find and substr There will be an example that goes over these functions.
Output NEEDS to look like this:
EMPLOYEE INFORMATION WHATEVER COMPANY INC.
Display all employees
Display name of oldest employee
Display the building letter and floor for Computer Science department
Display department names who are in building A
Find an employee and list their information
Average age of employees who live in Michigan
Return to menu
Exit the progam
Enter your selection for menu to exit:
Enter your selection for menu to exit:
Enter your selection for menu to exit: EMPLOYEEB
EMPLOYEE
EMPLOYEE
Option
oldest Employee Name
Abe, Rachel
Age:
Enter your selection for menu to exit: Building: A floor:
Enter your selection for menu to exit:
Option
Building A Departments
Computer Science
Account ing
Enter your selection for menu to exit:
Option Find
Departments on st floor of Building
Enter the ssn for the employee
:
Firstname Shannon
Lastname : Thomas
Middle Initial : L
City : Monroe
State :
Age :
Depart :
Depart Name : Human Resources
uilding Letter:
uilding floor :
Phone Number: e
Enter your selection for menu to exit: Departments on st floor of Building
Enter the ssi for the employee
The enployee with the ssn of does not exist
Enter your selection for menu to exit:
Option
Average age for employees who live in MI
Enter your selection for menu to exit:
Press any key to continue
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
