Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

SampleData Lines: SE 117.50 You will use the QUADFINES.TXT file as the input dat

ID: 3607934 • Letter: S

Question

SampleData Lines:

SE 117.50

You will use the QUADFINES.TXT file as theinput data file for this program

The citywould like to analyze the tickets issued in the north half of thecity vs. the tickets issued in the south half of the city. Therefore, they would like you to write a program to analyze thetickets issued and determine the low, high, and average fineslevied in north and in the south.You will use arrays to store the ticket data.

Write a program to process the data file. If the data file doesnot exist, the program should exit with a return code of 1 from themain function. If you attempt to open thefile from within another function, be sure to pass back informationabout the success or failure to main.

As you read each line of data, examine the quadrant information.Place the fine into one of two arrays for furtherprocessing later in the program:

All fines in the file will be 999.99 or less, and there shouldbe no more than 100 tickets issued in any one quadrant (so theremay be up to 400 entries in the data file). Maintain separatecounters for each array to keep track of how many fines you havestored in each one. If there are too many tickets stored inthe file to fit in one (or both) of the array(s), issue an errormessage to the user, and ignore any further file data for thatarray.

Do not perform any fine calculations while reading the data intothe arrays.

AFTER all the fines have been stored in the two arrays, use thedata in the arrays to calculate the low, high, and average fineslevied in the north, and the low, high, and fines levied in thesouth. Do NOT sort the array data to find the high and lowvalues.

Display the results neatly to the screen, along with a count foreach locale. Develop a generic output function that can becalled twice, once for each array's results.

Your program should take into account that tickets may have beenissued in the north quadrants ONLY or tickets may have been issuedin the south quadrants ONLY. If there were no tickets issued in onehalf of the city, your output should indicate that fact.

Sample output:

      For 21 tickets issued in theNORTH half of the city:

           Highest fine = $ 192.50

           Average fine = $   95.00

      For 53 tickets issued in theSOUTH half of the city:

           Highest fine = $ 212.00

           Average fine = $ 105.00

Explanation / Answer

please rate - thanks    youmentioned a function for the output so I used functions for otherthings too. If you haven't learned something used (bool etc)message me and I'll change it #include #include #include #include using namespace std; double low(double[],int); double high(double[],int); double average(double[],int); void output(int,double,double,double,string); int main(){ string quad; doublefine,north[200],south[200],nlow,slow,nhigh,shigh,naverage,saverage; int n=-1,s=-1; bool northissued=false, southissued=false; ifstream in;   in.open("quadfines.txt");          //open file   if(in.fail())            //is it ok?        { cout quad>>fine;    while(in)             {            if(quad=="NE"||quad=="NW")           {if(n=0)    {slow=low(south,s);     shigh=high(south,s);     saverage=average(south,s);     } output(s,slow,shigh,saverage,"SOUTH"); in.close(); system("pause"); return 0; } double low(double a[],int n) {int i;    double l;    l=a[0];    for(i=1;i
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote