Answered step by step
Verified Expert Solution
Link Copied!
Question
1 Approved Answer

WRITE CODE FROM THIS: write in c++ #include #include #include #include using namespace std; //function prototypesbool openFile(ifstream& inFile, string fileName);void ratioCalc(ifstream& inFile); //mainint main(){ ifstream


image

WRITE CODE FROM THIS:

write in c++

#include #include #include #include using namespace std;

//function prototypesbool openFile(ifstream& inFile, string fileName);void ratioCalc(ifstream& inFile);

//mainint main(){ ifstream inFile; string fileName; //cout << "Enter name of inputfile:"; //cin >> fileName; if (!openFile(inFile, "stem.txt")) { cout << "file did notopen. Program terminating!!!"; return 0; } ratioCalc(inFile); inFile.close();}

//function to open file//returns true if file opens//returns false if file does not open for any reason//parameters: file stream variable by reference and fileName

bool openFile(ifstream& inFile, string fileName){ inFile.open(fileName); if (!inFile) { return false; } return true;}

//write the ratioCalc function below this

STEM Analysis What percentage of men and women pursue STEM (Science, Technology, Engineering, Math) degrees? With your programming partner, you will complete a program that reads from a file called stem. txt and writes to an output file called stemout.txt. The text file can be found in the repl.it link. It does not store any data. But it uses loops and functions to read from the file and do some analysis. It calculates the percentage of men and women in each major and writes the name of the major, percentage men, and percentage women to the output file. Percentages should be printed to two decimal places. You must ignore the first line in stem. txt, which is a header line. The function openFile() has been written for you. You must write the ratioCalc() function. Optional: What other statistics can you calculate and add to the output file? Design a poster in Google slides to explain visually and upload.

Step by Step Solution

3.49 Rating (142 Votes )

There are 3 Steps involved in it

Step: 1

include using namespace std The output of the program mai... 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_2

Step: 3

blur-text-image_3

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

Income Tax Fundamentals 2013

Authors: Gerald E. Whittenburg, Martha Altus Buller, Steven L Gill

31st Edition

1111972516, 978-1285586618, 1285586611, 978-1285613109, 978-1111972516

More Books

Students explore these related Electrical Engineering questions