Boost your Grades with us today!

Anthropology homework help

3. Enhance the program to allow the user to enter 4 categories. Explain the changes you made to the code, and appropriate test data files. #include #define MAXN 100 // max characters in a group/concert name#define MAXG 5 // max concerts/groups#define MAXC  3 // max categorieschar group [MAXG][MAXN];int  fans  [MAXG][MAXC];float prices [MAXC];float sales [MAXG];int  count = 0;void printArray () { printf (“%15s%5s%5s%5s%10sn”, “Concert”, “s1”, “s2”, “s3”, “Sales”); for (int i = 0; i < count; i++) {   printf ("%15s", group [i]);   for (int j = 0; j < MAXC; j++) {     printf ("%5d", fans[i][j]);   } // end for each category   printf ("%10.2fn", sales [i]); } // end for each group} // end function printArrayvoid computeSales () { for (int i = 0; i < count; i++) {   sales [i] = 0;   for (int j = 0; j < MAXC; j++) {     sales [i] += prices [j] * fans [i][j];   } // end for each category } // end for each group} // end function computeSalesvoid switchRows (int m, int n) { char tc; int ti; float v; // printf ("Switching %d with %dn", m, n); for (int i = 0; i < MAXN; i++) {   tc = group [m][i];   group [m][i] = group [n][i];   group [n][i] = tc; } // end for each character in a group name for (int i = 0; i < MAXC; i++) {   ti = fans [m][i];   fans [m][i] = fans [n][i];   fans [n][i] = ti; } // end for each fan category v = sales [m]; sales [m] = sales [n]; sales [n] = v;} // end switchint findMinSales (int m) { float min = sales [m]; int target = m; for (int i = m+1; i < count; i++)   if (sales [i] < min) {     min = sales [i];     target = i;   } // end new max found return target;} // end function findMinSalesvoid sortBySales () { int target; for (int i = 0; i < count; i++) {   target = findMinSales (i);   if (target > i)     switchRows (i, target); } // for each concert} // end function sortBySalesvoid getData () { int i, j; // for (int i = 0; i < MAXG; i++) sales [i] = 0; printf ("Enter ticket prices in each of %d cateogories: ", MAXC); printf("n begin entry below ..."); for (int i = 0; i < MAXC; i++){   printf("n enter ticket price %d, of %d ",i+1,MAXC);   scanf ("%f", &prices [i]); } printf ("-- Enter group name and ticket sales in each of the %d categoriesn", MAXC); printf ("  . to finish entries:n"); for (int i = 0; i < MAXG; i++) {   printf("n Enter group name ");   scanf ("%s", &group[i]);   if (group [i][0] == '.')     break;   count++;   for (int j = 0; j < MAXC; j++){     printf ("n Enter the number of fans buying at ticket price %d ",j+1);     scanf ("%d", &fans[i][j]);   } } // end for each group} // end function getDataint main(void) { getData (); computeSales (); printArray (); printf ("n --- Sorted ---n"); sortBySales (); printArray (); printf("... bye ...n"); return 0;}

Solution:

15% off for this assignment.

Our Prices Start at $11.99. As Our First Client, Use Coupon Code GET15 to claim 15% Discount This Month!!

Why US?

100% Confidentiality

Information about customers is confidential and never disclosed to third parties.

Timely Delivery

No missed deadlines – 97% of assignments are completed in time.

Original Writing

We complete all papers from scratch. You can get a plagiarism report.

Money Back

If you are convinced that our writer has not followed your requirements, feel free to ask for a refund.

Need Help? Please contact us