Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

This is a c++ program I am creating in Linux- I keep getting errors on this one in both the void analyzeData function and the

This is a c++ program I am creating in Linux-

I keep getting errors on this one in both the void analyzeData function and the void popularMajor. Can you help me?

#include

#include

#include

#include

using namespace std;

//global constants

const int MAXCHAR = 101;

//Function Prototypes

void openFile(ifstream &inFile);

void analyzeData(ifstream &inFile, int &total, int &men, int &women);

void popularMajor(ifstream &inFile);

int main()

{

ifstream inFile;

int total = 0, men = 0, women = 0;

openFile(inFile);

analyzeData(inFile, total, men, women);

cout << "The total enrolled: " << total << endl;

cout << "The total men enrolled: " << men << endl;

cout << "The total women enrolled: " << women << endl;

popularMajor(inFile);

return 0;

}

//***ONLY CHANGE BELOW THIS LINE***//

//put your function implementations here.

void openFile(ifstream &inFile)

{

inFile.open("women-stem.txt");

if (!inFile)

{

cout << "File not Found! Program Exiting!" << endl;

exit(0);

}

}

void analyzeData(ifstream &inFile, int &total, int &men, int &women)

{

char major[MAXCHAR], majorCategory[MAXCHAR];

int majorCode, shareWomen, ftAnnualSalary;

inFile.ignore(1000, ' ');

while (!inFile.eof())

{

inFile.get(majorCode, ';');

inFile.get(major, MAXCHAR, ';');

inFile.get(majorCategory, MAXCHAR, ';');

inFile.get(total, ';');

inFile.get(men, ';');

inFile.get(women, ';');

inFile.get(shareWomen, ';');

inFile.get(ftAnnualSalary, ';');

}

}

void popularMajor(ifstream &inFile)

{

while (!inFile.eof())

{

if (temptotal > total)

{ major = popularMajor

}

}

}

//////////////////////////////////////BELOW IS THE inFILE information//////////////////////////////////////

Major Code;Major;Major_category;Total;Men;Women;ShareWomen;FT Annual Salary;;; 2419;PETROLEUM ENGINEERING;Engineering;2339;2057;282;0.120564344;110000;;; 2416;MINING AND MINERAL ENGINEERING;Engineering;756;679;77;0.101851852;75000;;; 2415;METALLURGICAL ENGINEERING;Engineering;856;725;131;0.153037383;73000;;; 2417;NAVAL ARCHITECTURE AND MARINE ENGINEERING;Engineering;1258;1123;135;0.107313196;70000;;; 2418;NUCLEAR ENGINEERING;Engineering;2573;2200;373;0.144966965;65000;;; 2405;CHEMICAL ENGINEERING;Engineering;32260;21239;11021;0.341630502;65000;;; 5001;ASTRONOMY AND ASTROPHYSICS;Physical Sciences;1792;832;960;0.535714286;62000;;; 2414;MECHANICAL ENGINEERING;Engineering;91227;80320;10907;0.119558903;60000;;; 2401;AEROSPACE ENGINEERING;Engineering;15058;12953;2105;0.139792801;60000;;; 2408;ELECTRICAL ENGINEERING;Engineering;81527;65511;16016;0.196450256;60000;;; 2407;COMPUTER ENGINEERING;Engineering;41542;33258;8284;0.199412643;60000;;; 5008;MATERIALS SCIENCE;Engineering;4279;2949;1330;0.310820285;60000;;; 2404;BIOMEDICAL ENGINEERING;Engineering;14955;8407;6548;0.437846874;60000;;; 2409;ENGINEERING MECHANICS PHYSICS AND SCIENCE;Engineering;4321;3526;795;0.183985189;58000;;; 2402;BIOLOGICAL ENGINEERING;Engineering;8925;6062;2863;0.320784314;57100;;; 2412;INDUSTRIAL AND MANUFACTURING ENGINEERING;Engineering;18968;12453;6515;0.343473218;57000;;; 2400;GENERAL ENGINEERING;Engineering;61152;45683;15469;0.252959838;56000;;; 2403;ARCHITECTURAL ENGINEERING;Engineering;2825;1835;990;0.350442478;54000;;; 2102;COMPUTER SCIENCE;Computers & Mathematics;128319;99743;28576;0.222695002;53000;;; 2502;ELECTRICAL ENGINEERING TECHNOLOGY;Engineering;11565;8181;3384;0.292607004;52000;;; 2413;MATERIALS ENGINEERING AND MATERIALS SCIENCE;Engineering;2993;2020;973;0.325091881;52000;;; 2499;MISCELLANEOUS ENGINEERING;Engineering;9133;7398;1735;0.189970437;50000;;; 2406;CIVIL ENGINEERING;Engineering;53153;41081;12072;0.227117943;50000;;; 2500;ENGINEERING TECHNOLOGIES;Engineering;3600;2695;905;0.251388889;50000;;; 2411;GEOLOGICAL AND GEOPHYSICAL ENGINEERING;Engineering;720;488;232;0.322222222;50000;;; 2410;ENVIRONMENTAL ENGINEERING;Engineering;4047;2662;1385;0.342228811;50000;;; 6107;NURSING;Health;209394;21773;187621;0.896018988;48000;;; 2503;INDUSTRIAL PRODUCTION TECHNOLOGIES;Engineering;4631;3477;1154;0.24919024;46000;;; 5102;NUCLEAR, INDUSTRIAL RADIOLOGY, AND BIOLOGICAL TECHNOLOGIES;Physical Sciences;2116;528;1588;0.75047259;46000;;; 2105;INFORMATION SCIENCES;Computers & Mathematics;11913;9005;2908;0.244103081;45000;;; 2100;COMPUTER AND INFORMATION SYSTEMS;Computers & Mathematics;36698;27392;9306;0.253583302;45000;;; 5007;PHYSICS;Physical Sciences;32142;23080;9062;0.281936407;45000;;; 3701;APPLIED MATHEMATICS;Computers & Mathematics;4939;2794;2145;0.434298441;45000;;; 3700;MATHEMATICS;Computers & Mathematics;72397;39956;32441;0.448098678;45000;;; 3702;STATISTICS AND DECISION SCIENCE;Computers & Mathematics;6251;2960;3291;0.526475764;45000;;; 3607;PHARMACOLOGY;Biology & Life Science;1762;515;1247;0.707718502;45000;;; 6105;MEDICAL TECHNOLOGIES TECHNICIANS;Health;15914;3916;11998;0.75392736;45000;;; 5006;OCEANOGRAPHY;Physical Sciences;2418;752;1666;0.688999173;44700;;; 2501;ENGINEERING AND INDUSTRIAL MANAGEMENT;Engineering;2906;2400;506;0.174122505;44000;;; 4005;MATHEMATICS AND COMPUTER SCIENCE;Computers & Mathematics;609;500;109;0.178981938;42000;;; 6104;MEDICAL ASSISTING SERVICES;Health;11123;803;10320;0.927807246;42000;;; 2101;COMPUTER PROGRAMMING AND DATA PROCESSING;Computers & Mathematics;4168;3046;1122;0.269193858;41300;;; 4006;COGNITIVE SCIENCE AND BIOPSYCHOLOGY;Biology & Life Science;3831;1667;2164;0.56486557;41000;;; 2504;MECHANICAL ENGINEERING RELATED TECHNOLOGIES;Engineering;4790;4419;371;0.077453027;40000;;; 2599;MISCELLANEOUS ENGINEERING TECHNOLOGIES;Engineering;8804;7043;1761;0.200022717;40000;;; 5000;PHYSICAL SCIENCES;Physical Sciences;1436;894;542;0.377437326;40000;;; 1401;ARCHITECTURE;Engineering;46420;25463;20957;0.451464886;40000;;; 3605;GENETICS;Biology & Life Science;3635;1761;1874;0.515543329;40000;;; 3603;MOLECULAR BIOLOGY;Biology & Life Science;18300;7426;10874;0.59420765;40000;;; 6108;PHARMACY PHARMACEUTICAL SCIENCES AND ADMINISTRATION;Health;23551;8697;14854;0.630716318;40000;;; 5003;CHEMISTRY;Physical Sciences;66530;32923;33607;0.505140538;39000;;; 3606;MICROBIOLOGY;Biology & Life Science;15232;6383;8849;0.580948004;38000;;; 2106;COMPUTER ADMINISTRATION MANAGEMENT AND SECURITY;Computers & Mathematics;8066;6607;1459;0.180882718;37500;;; 3601;BIOCHEMICAL SCIENCES;Biology & Life Science;39107;18951;20156;0.515406449;37400;;; 3602;BOTANY;Biology & Life Science;1329;626;703;0.52896915;37000;;; 2107;COMPUTER NETWORKING AND TELECOMMUNICATIONS;Computers & Mathematics;7613;5291;2322;0.305004597;36400;;; 5004;GEOLOGY AND EARTH SCIENCE;Physical Sciences;10972;5813;5159;0.470196865;36200;;; 5005;GEOSCIENCES;Physical Sciences;1978;809;1169;0.591001011;36000;;; 6199;MISCELLANEOUS HEALTH MEDICAL PROFESSIONS;Health;13386;1589;11797;0.881293889;36000;;; 1301;ENVIRONMENTAL SCIENCE;Biology & Life Science;25965;10787;15178;0.584556133;35600;;; 5002;ATMOSPHERIC SCIENCES AND METEOROLOGY;Physical Sciences;4043;2744;1299;0.321296067;35000;;; 2001;COMMUNICATION TECHNOLOGIES;Computers & Mathematics;18035;11431;6604;0.366176878;35000;;; 5098;MULTI-DISCIPLINARY OR GENERAL SCIENCE;Physical Sciences;62052;27015;35037;0.564639335;35000;;; 3608;PHYSIOLOGY;Biology & Life Science;22060;8422;13638;0.618223028;35000;;; 3611;NEUROSCIENCE;Biology & Life Science;13663;4944;8719;0.63814682;35000;;; 6103;HEALTH AND MEDICAL ADMINISTRATIVE SERVICES;Health;18109;4266;13843;0.764426528;35000;;; 4002;NUTRITION SCIENCES;Health;18909;2563;16346;0.864456079;35000;;; 6110;COMMUNITY AND PUBLIC HEALTH;Health;19735;4103;15632;0.792095262;34000;;; 3699;MISCELLANEOUS BIOLOGY;Biology & Life Science;10706;4747;5959;0.556603774;33500;;; 6106;HEALTH AND MEDICAL PREPARATORY PROGRAMS;Health;12740;5521;7219;0.566640502;33500;;; 3600;BIOLOGY;Biology & Life Science;280709;111762;168947;0.601858152;33400;;; 3604;ECOLOGY;Biology & Life Science;9154;3878;5276;0.576360061;33000;;; 6109;TREATMENT THERAPY PROFESSIONS;Health;48491;13487;35004;0.721865913;33000;;; 6100;GENERAL MEDICAL AND HEALTH SERVICES;Health;33599;7574;26025;0.774576624;32400;;; 6102;COMMUNICATION DISORDERS SCIENCES AND SERVICES;Health;38279;1225;37054;0.967998119;28000;;; 3609;ZOOLOGY;Biology & Life Science;8409;3050;5359;0.637293376;26000;;;

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

SQL Antipatterns Avoiding The Pitfalls Of Database Programming

Authors: Bill Karwin

1st Edition

1680508989, 978-1680508987

More Books

Students also viewed these Databases questions