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

#include <stdio.h> #include <stdlib.h> #include <time.h> #include <string.h> /**

ID: 3705440 • Letter: #

Question

 #include <stdio.h> #include <stdlib.h> #include <time.h> #include <string.h> /******************************************************************************  * In-lab Midterm2  * Print out a header - should contain your name, netid, lab time, and a   * brief description of the program   * Comments - include block comments to describe your code   * Write a program that will populate a 2-d array of c-strings that will  * be used for a classroom seating chart, print out  * all the strings entered in a table, and then calculate   * some values on the 2-d array of c-strings.  *  * Your main should read in the number of rows first and then columns   * that are in the seating chart.   * The code should make sure that the number of rows or number of   * columns requested is not larger than the 10x10 array and loop until   * values less than 10 are entered  You should have code in   * the main of your program that calls and display any results from the   * three functions in an appropriate manner.   * The 2d array and any other information MUST be passed to the functions.   * No global variables should be used.   *  * The first function readNames will populate the 2d array with C-strings.  * The function will have arguments for the number of   * rows and number of columns in the 2d grid. The function will then read  * the strings (including whitespace) storing them in columns first. (20 points)  *   * The next function, printChart, prints the 2d array of c-strings nicely as a   * table, making sure columns line up. Each row on the screen should correspond  * to each row in the seating chart.   * The third function will described on the board during your assigned  * lab time.    * */  void readNames(char myChart[10][10][15], int numRows, int numCols) {  // place code for readNames here  }  void printChart(char myChart[10][10][15], int numRows, int numCols) { // place code for printChart here  }  /******************************************************************************  * Third Function   * your function should return the number of names in the entire chart   * that are less than length   * AND create a 1-d array that   * holds the average length of the names per average over columns  (a 1-d array of   * doubles)   * length will be provided by the user and should be requested to be entered  * in main and passed to the function. The results from the function should  * then be displayed by main  ***************************************************************************/ int thirdFunction(char myChart[10][10][15], int numRows, int numCols, int length, double values[10]) { // place code for third function here  }  int main() { char ourRoom[10][10][15]; // largest chart we will need double results[10]; // for thirdFunction results  // place code here for your header  // place code here for reading in number rows, number columns, and // code that makes sure the rows and columns are always less than 10 and  // also code that calls your three functions appropriately   return 0; } 

Explanation / Answer

#include #include #include #include /****************************************************************************** * Comments - include block comments to describe your code (5 points, * done by grader) * Write a program that will populate a 2-d array of c-strings that will * be used for a classroom seating chart, print out * all the strings entered in a table, and then calculate * some values on the 2-d array of c-strings. * * Your main should read in the number of rows first and then columns * that are in the seating chart. (10 points done by autograder) * The code should make sure that the number of rows or number of * columns requested is not larger than the 10x10 array and loop until * values less than 10 are entered (10 points done by autograder). You should have code in * the main of your program that calls and display any results from the * three functions in an appropriate manner. (10 points done by grader) * * The 2d array and any other information MUST be passed to the functions. * No global variables should be used. * * The first function readNames will populate the 2d array with C-strings. * The function will have arguments for the number of * rows and number of columns in the 2d grid. The function will then read * the strings (including whitespace) storing them in columns first. (20 points) * * The next function, printChart, prints the 2d array of c-strings nicely as a * table, making sure columns line up. Each row on the screen should correspond * to each row in the seating chart. (20 points). (15 points autograded, * 5 points done by grader to make sure nicely formatted in columns) * * * */ void readNames(char myChart[10][10][15], int numRows, int numCols) { // place code for readNames here int i, j; for(i=0; i