# SIT172 Assignment 3

/*
SIT172 Assignment 3
Author :
Date   :
Problem Description
You are working as an Engineer for a materials manufacturing research lab and have been asked
to provide an automated solution to analyse data.
The data relates to a new material being developed.  The data is a measure of strength recorded
every 100mm of the material and is stored in a file.
Each line in the file represents a row of measurements on the material.  Data is separated by a comma (,).
Determine the final-value for each row and column of the data.
Create and display a final-value map that represents the value for each row and column as
follows:
If the value for a cell in each row is less than the average for the row and column, display -1
If the value for a cell in each row is greater than the average for the row and column display 1,
otherwise display 0
Calculate and display the count for the values 1, 0 and -1 for each row and column
Test the sheet using the following rules to determine if the sheet is rejected or accepted.
Rule 1. If any count for a row or column is greater or equal to than 50% of the number of rows or
columns then that row or column is rejected.
Report the number of times the patterns are detected.
Where 50 or more of the patterns are identified the sheet of material is rejected.
Otherwise the sheet is accepted.
The manufacturing process samples 1 of every 10 sheets produced, therefore the analysis will be
undertaken as required and must be completed
in a timely manner to enable the process to be stopped, recalculated, then restarted.
*/
#define _CRT_SECURE_NO_WARNINGS
#define _CRT_SECURE_NO_DEPRECATE
#include
#include
//#include
// Debug switch (‘1’ for debug ON, ‘0’ for debug OFF)
#define DEBUG 1
// Declared constants
// Name of file that stores our raw data
#define FILE_NAME “data-1.csv”
// Data size
#define MAX_ROWS 20
#define MAX_COLUMNS 20
//CONSTANT GREATER_THAN_CHAR = 1
const int GREATER_THAN_CHAR = 1;
//CONSTANT LESS_TAHN_CHAR = -1
const int LESS_THAN_CHAR = -1;
//CONSTANT NEITHER_CHAR = 0
const int NEITHER_CHAR = 0;
//CONSTANT MAX_CHARS = 3
#define MAX_CHARS 3
//CONSTANT TOLERANCE = 0.05
const double TOLERANCE = 0.05;
//CONSTANT RULE_1_HURDLE_PERCENT = 0.5
const double RULE_1_HURDLE_PERCENT = 0.5;
//CONSTANT RULE_2_HURDLE = 50
const int RULE_2_HURDLE = 50;
//CONSTANT PASSED_CHAR = ‘P’
const char PASSED_CHAR = ‘P’ ;
//CONSTANT INTERSECTION_PATTERN_CHAR = ‘I’
const char INTERSECTION_PATTERN_CHAR = ‘I’;
//CONSTANT ROW_PATTERN_CHAR = ‘R’
const char ROW_PATTERN_CHAR = ‘R’;
//CONSTANT COLUMN_PATTERN_CHAR = ‘C’
const char COLUMN_PATTERN_CHAR = ‘C’;
//’ Read the raw data from the data-1.csv file
// Misc variables used for reading the data from the file
float tempfloat = 0.0F;
char newline = ‘ ‘;
//INITIALISE rowIndex = 0
int rowIndex = 0;
//INITIALISE columnIndex = 0
int columnIndex = 0;
// Open the file for reading
FILE *infp;
infp = fopen(FILE_NAME, “r”);
// Check for errors and exit if found
if (infp == NULL)
{
printf(“Error: failed to open %s for readingn”, FILE_NAME);
return(1);
}
// Read the file into the data structure
for (rowIndex = 0; rowIndex < MAX_ROWS; rowIndex++) { // Read up until the last value for (columnIndex = 0; columnIndex < MAX_COLUMNS – 1; columnIndex++) { if (fscanf(infp, “%f,”, &tempfloat) != EOF) { rawData[rowIndex][columnIndex] = tempfloat; } else { printf(“Error: incorrect file format at row %d, col %d.n”, rowIndex + 1, columnIndex + 1); return(1); } } // Read the last value and the newline char if (fscanf(infp, “%f%c”, &tempfloat, &newline) != EOF) { // Check if the last character in the line was a n otherwise an error occured if (newline != ‘’ && newline != ‘n’ && newline != ‘r’) { printf(“Error: incorrect file format at line %d. did not find a newline.n”, rowIndex + 1); return(1); } else { rawData[rowIndex][columnIndex] = tempfloat; } // Reset the character before the next read newline = ‘ ‘; } } // Close the file fclose(infp); return 0; } //calculate final-value for each row/column, final-value map void calculate(float rawData[][MAX_COLUMNS], float rowFinalValues[], float columnFinalValues[], int finalValueMap[][MAX_COLUMNS]){ //INITIALISE total = 0 float total = 0; //INITIALISE rowIndex = 0 int rowIndex = 0; //INITIALISE columnIndex = 0 int columnIndex = 0; //INITIALISE value = 0 float value = 0; //INITIALIZE finalValue = 0 float finalValue = 0; //Calculate the final-value for each row /* FOR rowIndex TO MAX_ROWS ‘ Calculate the total of each row FOR columnIndex TO MAX_COLUMNS value = rawData[rowIndex, columnIndex] total = total + value END FOR ‘ Calculate the final-value as per the requirements finalValue = (total / MAX_ROWS) finalValue = finalValue * finalValue finalValue = finalValue + TOLERANCE ‘ Store the final-value for each row rowFinalValues[rowIndex] = finalValue ‘ Reset our variables back to 0 for each new row total = 0 finalValue = 0 END FOR */ for (rowIndex = 0; rowIndex < MAX_ROWS; rowIndex++) { for (columnIndex = 0; columnIndex < MAX_COLUMNS; columnIndex++) { value = rawData[rowIndex][columnIndex]; total = total + value ; } finalValue = (total / (double)MAX_ROWS); finalValue = finalValue * finalValue; finalValue = finalValue + TOLERANCE; rowFinalValues[rowIndex] = finalValue; total = 0; finalValue = 0; } //Calculate the final-value for each column /* FOR columnIndex TO MAX_COLUMNS ‘ Calculate the total of each column FOR rowIndex TO MAX_ROWS value = rawData[rowIndex, columnIndex] total = total + value END FOR ‘ Calculate the final-value as per the requirements finalValue = (total / MAX_COLUMNS) finalValue = finalValue * finalValue finalValue = finalValue + TOLERANCE ‘ Store the final-value for each column columnFinalValues[columnIndex] = finalValue ‘ Reset our variables back to 0 for each new column total = 0 finalValue = 0 END FOR */ for (columnIndex = 0; columnIndex < MAX_COLUMNS; columnIndex++) { for (rowIndex = 0; rowIndex < MAX_ROWS; rowIndex++) { value = rawData[rowIndex][columnIndex]; total = total + value ; } finalValue = (total / (double)MAX_COLUMNS); finalValue = finalValue * finalValue; finalValue = finalValue + TOLERANCE; columnFinalValues[columnIndex] = finalValue; total = 0; finalValue = 0; } // Calculate the final-value map /* FOR rowIndex TO MAX_ROWS FOR columnIndex TO MAX_COLUMNS value = rawData[rowIndex, columnIndex] ‘ Determine whether our raw data value is greater than, less than, or neither its final-value IF value > rowFinalValues[rowIndex] AND value > columnFinalValues[columnIndex] THEN
finalValueMap[rowIndex, columnIndex] = GREATER_THAN_CHAR
ELSE IF value < rowFinalValues[rowIndex] AND value < columnFinalValues[columnIndex] THEN finalValueMap[rowIndex, columnIndex] = LESS_THAN_CHAR ELSE finalValueMap[rowIndex, columnIndex] = NEITHER_CHAR END IF END FOR END FOR */ for (rowIndex = 0; rowIndex < MAX_ROWS; rowIndex++){ for (columnIndex = 0; columnIndex < MAX_COLUMNS; columnIndex++){ value = rawData[rowIndex][columnIndex]; if (value > rowFinalValues[rowIndex] && value > columnFinalValues[columnIndex])
{
finalValueMap[rowIndex][columnIndex] = GREATER_THAN_CHAR;
}else if (value < rowFinalValues[rowIndex] && value < columnFinalValues[columnIndex]){ finalValueMap[rowIndex][columnIndex] = LESS_THAN_CHAR; }else{ finalValueMap[rowIndex][columnIndex] = NEITHER_CHAR; } } } } //search patterns void searchPatterns(char patternMap[][MAX_COLUMNS], int finalValueMap[][MAX_COLUMNS], int* intersectionPatternCount, int* rowPatternCount, int* columnPatternCount){ int patternFound = 0; //INITIALISE rowIndex = 0 int rowIndex = 0; //INITIALISE columnIndex = 0 int columnIndex = 0; //Determine whether any patterns exist in our final-value map. First we want to initialize our pattern    map to be all ‘passes’ /* FOR rowIndex TO MAX_ROWS FOR columnIndex TO MAX_COLUMNS patternMap[rowIndex, columnIndex] = PASSED_CHAR END END */ for (rowIndex = 0; rowIndex < MAX_ROWS; rowIndex++){ for (columnIndex = 0; columnIndex < MAX_COLUMNS; columnIndex++){ patternMap[rowIndex][columnIndex] = PASSED_CHAR; } } // Search for patterns in the final-value map. /* INITIALIZE patternFound = false; FOR rowIndex TO MAX_ROWS FOR columnIndex TO MAX_COLUMNS ‘ We want to search for our three pattern types, an Intersection, a Row, and a Column pattern. However, we ‘ must be careful when searching for these patterns that we do not search outside the boundary of our 2-D ‘ map array. Before each search, we check if we are too close to a particular boundary, and if we are, we ‘ do not search for that particular pattern. IF rowIndex != 1 AND rowIndex != MAX_ROWS AND columnIndex != 1 && columnIndex != MAX_COLUMNS ‘ First look for an Intersection pattern IF finalValueMap[rowIndex, columnIndex] == finalValueMap[rowIndex – 1, columnIndex] AND finalValueMap[rowIndex, columnIndex] == finalValueMap[rowIndex + 1,     columnIndex] AND finalValueMap[rowIndex, columnIndex] == finalValueMap[rowIndex,    columnIndex – 1] AND  finalValueMap[rowIndex, columnIndex] == finalValueMap[rowIndex, columnIndex + 1] THEN ‘ If true, we have found an Intersection pattern patternMap[rowIndex, columnIndex] = INTERSECTION_PATTERN_CHAR intersectionPatternCount = intersectionPatternCount + 1 patternFound = true END IF END IF IF patternFound = false AND columnIndex != 1 && columnIndex != MAX_COLUMNS ‘If not pattern is yet found, look for a Row pattern, if we are not at the left or right boundary however IF finalValueMap[rowIndex, columnIndex] == finalValueMap[rowIndex, columnIndex – 1] AND finalValueMap[rowIndex, columnIndex] == finalValueMap[rowIndex, columnIndex + 1] THEN ‘ If true, we have found a Row pattern patternMap[rowIndex, columnIndex] = ROW_PATTERN_CHAR rowPatternCount = rowPatternCount + 1 patternFound = true END IF END IF IF patternFound = false AND rowIndex != 1 AND rowIndex != MAX_ROWS ‘ If no pattern is yet found, look for a Column pattern, if we are not at the top or bottom boundary however IF finalValueMap[rowIndex, columnIndex] == finalValueMap[rowIndex – 1, columnIndex] AND finalValueMap[rowIndex, columnIndex] == finalValueMap[rowIndex + 1, columnIndex] THEN ‘ If true, we have found a Column pattern patternMap[rowIndex, columnIndex] = COLUMN_PATTERN_CHAR columnPatternCount = columnPatternCount + 1 END IF END IF ‘ Reset our variablse patternFound = false END FOR END FOR */ patternFound = 0; for (rowIndex = 0; rowIndex < MAX_ROWS; rowIndex++){ for (columnIndex = 0; columnIndex < MAX_COLUMNS; columnIndex++){ if (rowIndex + 1 >= 0 && rowIndex + 1 < MAX_ROWS && columnIndex – 1 >= 0 && columnIndex + 1 < MAX_COLUMNS ) { if (finalValueMap[rowIndex][columnIndex] == finalValueMap[rowIndex – 1][columnIndex] && finalValueMap[rowIndex][columnIndex] == finalValueMap[rowIndex + 1][columnIndex] && finalValueMap[rowIndex][columnIndex] == finalValueMap[rowIndex][columnIndex – 1] &&  finalValueMap[rowIndex][columnIndex] == finalValueMap[rowIndex][columnIndex + 1]) { patternMap[rowIndex][columnIndex] = INTERSECTION_PATTERN_CHAR; *intersectionPatternCount = *intersectionPatternCount + 1; patternFound = 1; } } if (patternFound == 0 && columnIndex – 1 >= 0 && columnIndex  – 1 < MAX_COLUMNS) { if (finalValueMap[rowIndex][columnIndex] == finalValueMap[rowIndex][columnIndex – 1] && finalValueMap[rowIndex][columnIndex] == finalValueMap[rowIndex][columnIndex + 1]) { patternMap[rowIndex][columnIndex] = ROW_PATTERN_CHAR; *rowPatternCount = *rowPatternCount + 1; patternFound = 1; } } if (patternFound == 0 && rowIndex – 1 >= 0 && rowIndex + 1 < MAX_ROWS) { if (finalValueMap[rowIndex][columnIndex] == finalValueMap[rowIndex – 1][columnIndex] && finalValueMap[rowIndex][columnIndex] == finalValueMap[rowIndex + 1][columnIndex]) { patternMap[rowIndex][columnIndex] = COLUMN_PATTERN_CHAR; *columnPatternCount = *columnPatternCount + 1; patternFound = 1; } } patternFound = 0; } } } // Main entry point for the program int main(void) { // Variables //INITIALISE rawData[MAX_ROWS, MAX_COLUMNS] float rawData[MAX_ROWS][MAX_COLUMNS]; // 2-dimensional array to store our raw data //INITIALISE rowIndex = 0 int rowIndex = 0; //INITIALISE columnIndex = 0 int columnIndex = 0; //INITIALISE value = 0 float value = 0; //INITIALISE rowFinalValues[MAX_ROWS] float rowFinalValues[MAX_ROWS]; //INITIALISE columnFinalValues[MAX_COLUMNS] float columnFinalValues[MAX_ROWS]; //INITIALISE finalValueMap[MAX_ROWS, MAX_COLUMNS] int finalValueMap[MAX_ROWS][MAX_COLUMNS]; //INITIALISE patternMap[MAX_ROWS, MAX_COLUMNS] char patternMap[MAX_ROWS][MAX_COLUMNS]; //INITIALISE rowSymbolCounts[MAX_ROWS, MAX_CHARS] int rowSymbolCounts[MAX_ROWS][MAX_CHARS]; //INITIALISE columnSymbolCounts[MAX_CHARS, MAX_COLUMNS] int columnSymbolCounts[MAX_CHARS][MAX_COLUMNS]; //INITIALISE greaterThanCounter = 0 int greaterThanCounter = 0; //INITIALISE lessThanCounter = 0 int lessThanCounter = 0; //INITIALISE neitherCounter = 0 int neitherCounter = 0; //INITIALISE rule1RowHurdle = MAX_ROWS * RULE_1_HURDLE_PERCENT float rule1RowHurdle = MAX_ROWS * RULE_1_HURDLE_PERCENT ; //INITIALISE rule1ColumnHurdle = MAX_COLUMNS * RULE_1_HURDLE_PERCENT float rule1ColumnHurdle = MAX_COLUMNS * RULE_1_HURDLE_PERCENT; //INITIALISE rowPatternCount = 0 int  rowPatternCount = 0; //INITIALIZE columnPatternCount = 0 int columnPatternCount = 0; //INITIALIZE intersectionPatternCount = 0 int intersectionPatternCount = 0; //load data if (loadData(rawData) != 0) { return 1; } // Print out the raw data read from the file if (DEBUG == 1) { printf(” — RAW DATA —n”); for (rowIndex = 0; rowIndex < MAX_ROWS; rowIndex++) { // Read up until the last value for (columnIndex = 0; columnIndex < MAX_COLUMNS; columnIndex++) { printf(“%.5f “, rawData[rowIndex][columnIndex]); } printf(“n”); } } //calculate final-value for each row/column, final-value map calculate(rawData, rowFinalValues, columnFinalValues, finalValueMap); //Print our final-value map /* PRINT ” — FINAL-VALUE MAP —n” FOR rowIndex TO MAX_ROWS FOR columnIndex TO MAX_COLUMNS value = finalValueMap[rowIndex, columnIndex] PRINT value + ” ” END FOR ‘ Print a new line at the end of each row PRINT newline END FOR */ printf(“— FINAL-VALUE MAP —n”); for (rowIndex = 0; rowIndex < MAX_ROWS; rowIndex++){ for (columnIndex = 0; columnIndex < MAX_COLUMNS; columnIndex++){ printf(“%3d”,finalValueMap[rowIndex][columnIndex]); } printf(“n”); } //Calculate the counts of each symbol for our rows /* FOR rowIndex TO MAX_ROWS FOR columnIndex TO MAX_COLUMNS value = finalValueMap[rowIndex, columnIndex] ‘ Determine which symbol we have found, and add 1 to our counters IF value == GREATER_THAN_SYMBOL THEN greaterThanCounter = greaterThanCounter + 1 ELSE IF value == LESS_THAN_SYMBOL THEN lessThanCounter = lessThanCounter + 1 ELSE neitherCounter = neitherCounter + 1 END IF END FOR ‘ Store our count results for each row rowSymbolCounts[rowIndex, 0] = greaterThanCounter rowSymbolCounts[rowIndex, 1] = lessThanCounter rowSymbolCounts[rowIndex, 2] = neitherThanCounter ‘ Reset our counters for each row greaterThanCounter = 0 lessThanCounter = 0 neitherThanCounter = 0 END FOR */ for (rowIndex = 0; rowIndex < MAX_ROWS; rowIndex++){ for (columnIndex = 0; columnIndex < MAX_COLUMNS; columnIndex++){ value = finalValueMap[rowIndex][columnIndex]; if (value == GREATER_THAN_CHAR) { greaterThanCounter = greaterThanCounter + 1; }else if (value == LESS_THAN_CHAR) { lessThanCounter = lessThanCounter + 1; }else{ neitherCounter = neitherCounter + 1; } } rowSymbolCounts[rowIndex][0] = greaterThanCounter; rowSymbolCounts[rowIndex][1] = lessThanCounter; rowSymbolCounts[rowIndex][2] = neitherCounter; greaterThanCounter = 0; lessThanCounter = 0; neitherCounter = 0; } // Calculate the counts of each symbol for our columns /* FOR columnIndex TO MAX_COLUMNS FOR rowIndex TO MAX_ROWS value = finalValueMap[rowIndex, columnIndex] ‘ Determine which symbol we have found, and add 1 to our counters IF value == GREATER_THAN_SYMBOL THEN greaterThanCounter = greaterThanCounter + 1 ELSE IF value == LESS_THAN_SYMBOL THEN lessThanCounter = lessThanCounter + 1 ELSE neitherCounter = neitherCounter + 1 END IF END FOR ‘ Store our count results for each column columnSymbolCounts[0, columnIndex] = greaterThanCounter columnSymbolCounts[1, columnIndex] = lessThanCounter columnSymbolCounts[2, columnIndex] = neitherThanCounter ‘ Reset our counters for each column greaterThanCounter = 0 lessThanCounter = 0 neitherThanCounter = 0 END FOR */ for (columnIndex = 0; columnIndex < MAX_COLUMNS; columnIndex++){ for (rowIndex = 0; rowIndex < MAX_ROWS; rowIndex++){ value = finalValueMap[rowIndex][columnIndex]; if (value == GREATER_THAN_CHAR) { greaterThanCounter = greaterThanCounter + 1; }else if (value == LESS_THAN_CHAR) { lessThanCounter = lessThanCounter + 1; }else{ neitherCounter = neitherCounter + 1; } } columnSymbolCounts[0][columnIndex] = greaterThanCounter; columnSymbolCounts[1][columnIndex] = lessThanCounter; columnSymbolCounts[2][columnIndex] = neitherCounter; greaterThanCounter = 0; lessThanCounter = 0; neitherCounter = 0; } //Print our symbol counts for each row /* PRINT ” — ROW SYMBOL COUNTS —n” PRINT GREATER_THAN_SYMBOL + ” ” + LESS_THAN_SYMBOL + ” ” + NEITHER_SYMBOL FOR rowIndex TO MAX_ROWS FOR columnIndex TO MAX_CHARS PRINT rowSymbolCounts[rowIndex, columnIndex] + ” ” + rowSymbolCounts[rowIndex, columnIndex] + ” ” + rowSymbolCounts[rowIndex, columnIndex] END FOR ‘ Print a new line at the end of each row PRINT newline END FOR */ printf(“— ROW SYMBOL COUNTS —n”); printf(“%3d %3d %3dn”, GREATER_THAN_CHAR, LESS_THAN_CHAR, NEITHER_CHAR); for (rowIndex = 0; rowIndex < MAX_ROWS; rowIndex++){ for (columnIndex = 0; columnIndex < MAX_CHARS; columnIndex++){ printf(“%3d “, rowSymbolCounts[rowIndex][columnIndex]); } printf(“n”); } //Print our symbol counts for each column /* PRINT ” — COLUMN SYMBOL COUNTS —n” PRINT GREATER_THAN_SYMBOL + newline + LESS_THAN_SYMBOL + newline + NEITHER_SYMBOL FOR rowIndex TO MAX_CHARS FOR columnIndex TO MAX_COLUMNS PRINT columnSymbolCounts[rowIndex, columnIndex] + ” ” +    columnSymbolCounts[rowIndex, columnIndex] + ” ” + columnSymbolCounts[rowIndex, columnIndex] END FOR ‘ Print a new line at the end of each row PRINT newline END FOR */ printf(“— COLUMN SYMBOL COUNTS —n”); printf(“%1d %1d %1dn”, GREATER_THAN_CHAR, LESS_THAN_CHAR, NEITHER_CHAR); for (rowIndex = 0; rowIndex < MAX_CHARS; rowIndex++){ for (columnIndex = 0; columnIndex < MAX_COLUMNS; columnIndex++){ printf(“%3d “, columnSymbolCounts[rowIndex][columnIndex]); } printf(“n”); } //Calculate the results of Rule 1 for each row /* PRINT “— RULE 1 APPLIED TO EACH ROW —n” FOR rowIndex TO MAX_ROWS ‘ Check the counts for each symbol, and compare it to the Rule 1 hurdle IF rowSymbolCounts[rowIndex, 0] >= rule1RowHurdle OR rowSymbolCounts[rowIndex, 1] >=  rule1RowHurdle OR rowSymbolCounts[rowIndex, 2] >= rule1RowHurdle THEN
PRINT “Row number ” + rowIndex + ” has FAILED”
ELSE
PRINT “Row number ” + rowIndex + ” has PASSED”
END IF
‘ Print a new line at the end of each row
PRINT newline
END FOR
*/
printf(“— RULE 1 APPLIED TO EACH ROW —n”);
for (rowIndex = 0; rowIndex < MAX_ROWS; rowIndex++){ if (rowSymbolCounts[rowIndex][0] >= rule1RowHurdle || rowSymbolCounts[rowIndex][1] >= rule1RowHurdle || rowSymbolCounts[rowIndex][2] >= rule1RowHurdle)
{
printf(“Row number %d has FAILEDn”, rowIndex);
}else{
printf(“Row number %d has PASSEDn”, rowIndex);
}
}
//Calculate the results of Rule 1 for each column
/*
PRINT “— RULE 1 APPLIED TO EACH COLUMN —n”
FOR columnIndex TO MAX_COLUMNS
‘ Check the counts for each symbol, and compare it to the Rule 1 hurdle
IF columnSymbolCounts[0, columnIndex] >= rule1ColumnHurdle OR columnSymbolCounts[columnIndex] >= rule1ColumnHurdle OR columnSymbolCounts[2, columnIndex] >= rule1ColumnHurdle THEN
PRINT “Column number ” + columnIndex + ” has FAILED”
ELSE
PRINT “Column number ” + columnIndex + ” has PASSED”
END IF
‘ Print a space at the end of each column
PRINT ” ”
END FOR
*/
printf(“— RULE 1 APPLIED TO EACH COLUMN —n”);
for (columnIndex = 0; columnIndex < MAX_COLUMNS; columnIndex++){ if (columnSymbolCounts[0][columnIndex] >= rule1ColumnHurdle || columnSymbolCounts[1][columnIndex] >= rule1ColumnHurdle || columnSymbolCounts[2][columnIndex] >= rule1ColumnHurdle)
{
printf(“Column number %d has FAILEDn”, rowIndex);
}else{
printf(“Column number %d has PASSEDn”, rowIndex);
}
}
//search patterns
searchPatterns(patternMap, finalValueMap, &intersectionPatternCount, &rowPatternCount, &columnPatternCount);
//Print each value in our pattern map array
/*
PRINT “nn — PATTERN MAP —n”
FOR rowIndex TO MAX_ROWS
FOR columnIndex TO MAX_COLUMNS
PRINT patternMap[rowIndex, columnIndex]
END FOR
‘ Print a newline for each row
PRINT “n”
END FOR
*/
printf(“nn— PATTERN MAP —n”);
for (rowIndex = 0; rowIndex < MAX_ROWS; rowIndex++){ for (columnIndex = 0; columnIndex < MAX_COLUMNS; columnIndex++){ printf(“%c “, patternMap[rowIndex][columnIndex]); } printf(“n”); } //Print the values of our pattern counts /* PRINT “nn — PATTERN COUNTS —n” PRINT “Row patterns found: ” + rowPatternCount + newline PRINT “Column patterns found: ” + columnPatternCount + newLine PRINT “Intersection patterns found: ” + intersectionPatternCount + newLine PRINT “Total patterns found: ” + (rowPatternCount + columnPatternCount + intersectionPatternCount) */ printf(“nn— PATTERN COUNTS —n”); printf(“Row patterns found: %dn”, rowPatternCount); printf(“Column patterns found: %dn”, columnPatternCount); printf(“Intersection patterns found: %dn”, intersectionPatternCount); printf(“Total patterns found: %dn”, (rowPatternCount + columnPatternCount + intersectionPatternCount)); //Determine the resule of Rule 2 /* PRINT “nn — RULE 2 RESULT —n” IF (rowPatternCount + columnPatternCount + intersectionPatternCount) >= RULE_2_HURDLE
PRINT “SHEET FAILED: The sheet contains ” + rowPatternCount + columnPatternCount + intersectionPatternCount ” patterns, which is greater than the Rule 2 requirement of ” + RULE_2_HURDLE + ” or more patterns”
ELSE
PRINT “SHEET PASSED: The sheet contains ” + rowPatternCount + columnPatternCount + intersectionPatternCount ” patterns, which is less than than the Rule 2 requirement of ” + RULE_2_HURDLE + ” patterns”
END
*/
printf(“nn— RULE 2 RESULT —n”);
if ((rowPatternCount + columnPatternCount + intersectionPatternCount) >= RULE_2_HURDLE)
{
printf(“SHEET FAILED: The sheet contains %d patterns, which is greater than the Rule 2 requirement of %d or more patternsn”, rowPatternCount + columnPatternCount + intersectionPatternCount, RULE_2_HURDLE);
}else{
printf(“SHEET PASSED: The sheet contains %d patterns, which is less than than the Rule 2 requirement of %d patternsn”, rowPatternCount + columnPatternCount + intersectionPatternCount, RULE_2_HURDLE);
}
// Exit
return (0);
}

# Our Service Charter

1. ### Excellent Quality / 100% Plagiarism-Free

We employ a number of measures to ensure top quality essays. The papers go through a system of quality control prior to delivery. We run plagiarism checks on each paper to ensure that they will be 100% plagiarism-free. So, only clean copies hit customers’ emails. We also never resell the papers completed by our writers. So, once it is checked using a plagiarism checker, the paper will be unique. Speaking of the academic writing standards, we will stick to the assignment brief given by the customer and assign the perfect writer. By saying “the perfect writer” we mean the one having an academic degree in the customer’s study field and positive feedback from other customers.
2. ### Free Revisions

We keep the quality bar of all papers high. But in case you need some extra brilliance to the paper, here’s what to do. First of all, you can choose a top writer. It means that we will assign an expert with a degree in your subject. And secondly, you can rely on our editing services. Our editors will revise your papers, checking whether or not they comply with high standards of academic writing. In addition, editing entails adjusting content if it’s off the topic, adding more sources, refining the language style, and making sure the referencing style is followed.
3. ### Confidentiality / 100% No Disclosure

We make sure that clients’ personal data remains confidential and is not exploited for any purposes beyond those related to our services. We only ask you to provide us with the information that is required to produce the paper according to your writing needs. Please note that the payment info is protected as well. Feel free to refer to the support team for more information about our payment methods. The fact that you used our service is kept secret due to the advanced security standards. So, you can be sure that no one will find out that you got a paper from our writing service.
4. ### Money Back Guarantee

If the writer doesn’t address all the questions on your assignment brief or the delivered paper appears to be off the topic, you can ask for a refund. Or, if it is applicable, you can opt in for free revision within 14-30 days, depending on your paper’s length. The revision or refund request should be sent within 14 days after delivery. The customer gets 100% money-back in case they haven't downloaded the paper. All approved refunds will be returned to the customer’s credit card or Bonus Balance in a form of store credit. Take a note that we will send an extra compensation if the customers goes with a store credit.

We have a support team working 24/7 ready to give your issue concerning the order their immediate attention. If you have any questions about the ordering process, communication with the writer, payment options, feel free to join live chat. Be sure to get a fast response. They can also give you the exact price quote, taking into account the timing, desired academic level of the paper, and the number of pages.

Excellent Quality
Zero Plagiarism
Expert Writers

or

Instant Quote