IN C++ ONLY PLEASE Write a program to read in occupation data from a file, and output the occupations with the highest a

Business, Finance, Economics, Accounting, Operations Management, Computer Science, Electrical Engineering, Mechanical Engineering, Civil Engineering, Chemical Engineering, Algebra, Precalculus, Statistics and Probabilty, Advanced Math, Physics, Chemistry, Biology, Nursing, Psychology, Certifications, Tests, Prep, and more.
Post Reply
answerhappygod
Site Admin
Posts: 899603
Joined: Mon Aug 02, 2021 8:13 am

IN C++ ONLY PLEASE Write a program to read in occupation data from a file, and output the occupations with the highest a

Post by answerhappygod »

IN C++ ONLY PLEASE Write a program to read in occupation data
from a file, and output the occupations with the highest and lowest
percentages of jobs susceptible to automation. The program should
read the occupations’ names and the employment numbers from an
input file called aidata.txt. Each row in the file contains
occupation name, total employment numbers, and the number of
employees susceptible to automation separated by a semi-colon. Use
inFile.getline(strVar, MAXCHAR, ‘;’); to read the occupation name
and ignore the semi colon. inFile is the stream variable that you
create. Use inFile >> employNumbers[j]; followed by
inFile.ignore(5, ‘;’); to read the total employment numbers and
ignore the semi colon. Use inFile >> employNumbers[j];
followed by inFile.ignore(5, ‘\n’); to read the number of employees
susceptible to automation and ignore the newline character at the
end of the line. Your program will use a two-dimensional integer
array to store the total employment numbers and number of employees
susceptible to automation for each major occupation. The array
wil have a maximum of 30 rows and 2 columns. Column 0 will
contain the total number employed in the occupation (number is in
thousands.) Column 1 will contain the total number of jobs in the
occupation susceptible to automation (number is in thousands.) The
row number in this table corresponds with the same row number in
the occupations names array. You should also have a two-dimensional
char parallel array to store the names of the major occupations as
char arrays. This array will also have a maximum of 30 rows. You
may not use strings! You can assume the maximum length of an
occupation name will be 20 characters. Row 0 in this array will
contain the char array for Administration and will correspond to
row 0 in the employment numbers array. Your program must use the
following functions: loadData() - reads and stores data in the
two-dimensional arrays from the text file (aidata.txt) void
loadData(ifstream &infile, char occupations[][20], int
nums[][2], int &rows); printData() - prints the contents of the
two arrays and the calculated percentage of susceptible jobs for
each occupation void printData(char occupations[][20], int
nums[][2], int rows); findHigh() - finds and updates the highest
percentage of susceptibility of automation and the corresponding
occupation (you must print the results in main()) void
findHigh(char occupations[][20], int nums[][2], int rows, char
occupation[], double &highPercent); findLow() - finds and
updates the lowest percentage of susceptibility of automation and
the corresponding occupation (you must print the results in main())
void findLow(char occupations[][20], int nums[][2], int rows, char
occupation[], double &lowPercent); You must use function
prototypes and write your main() function at the top of your
program, followed by the other function definitions. Occupation
Name Employed Automation Percent % _______________ ________
__________ _________ Administrative 23081 13849 60.0017%
Agriculture 1060 594 56.0377% Arts Entertainment 2773 555 20.0144%
Business 8067 1129 13.9953% Computer 4419 1635 36.9993%
Construction 6813 3407 50.0073% Education 9427 1697 18.0015%
Engineering 2601 494 18.9927% Facilities Care 5905 2893 48.9924%
Food Service 13206 10697 81.0011% Health Practitioner 8752 2888
32.9982% Health Support 4316 1726 39.9907% Legal 1283 488 38.0359%
Maintenance 5654 1187 20.994% Management 9533 2193 23.0043%
Personal Care 6420 2183 34.0031% Production 9357 7592 81.1371%
Protective 3506 1262 35.9954% Sales 15748 6772 43.0023% Science
1300 416 32 % Social Service 2571 566 22.0148% Transportation 10274
5651 55.0029% Highest/Lowest Occupations Susceptible to Automation:
Production has the highest share (81%) Business has the lowest
share (14%)
Join a community of subject matter experts. Register for FREE to view solutions, replies, and use search function. Request answer by replying!
Post Reply