Question
Please follow Instruction on sheet below..program in C#, output genrated should look similar to the output on sheet below also..all files (Array Processing.cs,MatrixDat.txt,MatrixRpt.txt) that are
Please follow Instruction on sheet below..program in C#, output genrated should look similar to the output on sheet below also..all files (Array Processing.cs,MatrixDat.txt,MatrixRpt.txt) that are needed are also included below..their are hints with the note //missing code in the Array Processing.cs..those hints should help you figure out whats needed to get expected output similar to sheet below
-----------------------------------------------------------------------------------------------------------
//Array Processing.cs
using System; using System.IO; using LibUtil;
namespace ArrayProcessing { class ArrayProcessing {
const string INPUT_FILE_NAME = "...\\...\\MatrixDat.Txt"; const string OUTPUT_FILE_NAME = "...\\...\\MatrixRpt.Txt";
static int numOfRows, numOfCols; static string matrixLabel; static int[,] matrix; static StreamReader fileIn; static StreamWriter fileOut;
static void Main() { OpenFiles(); GenReport(); CloseFiles(); }
static void OpenFiles() { try { fileIn = File.OpenText(INPUT_FILE_NAME); Console.WriteLine("{0} was opened", INPUT_FILE_NAME); } catch { Console.WriteLine("Error: {0} does not exist ", INPUT_FILE_NAME); ConsoleApp.Exit(); } try { fileOut = File.CreateText(OUTPUT_FILE_NAME); Console.WriteLine("{0} was created ", OUTPUT_FILE_NAME); } catch { Console.WriteLine("Error: {0} could not be created ", OUTPUT_FILE_NAME); ConsoleApp.Exit(); } }
static void GenReport() { int i, row, col, numOfMatrices, indent;
// Fill in missing code
fileOut.WriteLine("Date: {0:MM/dd/yyyy}", DateTime.Now); fileOut.WriteLine(); numOfMatrices = Int32.Parse(fileIn.ReadLine()); for (i = 1; i
static void InputMatrix() { int row, col; string[] words;
matrixLabel = fileIn.ReadLine(); words = StringMethods.SpaceDelimit(fileIn.ReadLine()).Split(' '); numOfRows = Int32.Parse(words[0]); numOfCols = Int32.Parse(words[1]); matrix = new int[numOfRows + 1, numOfCols + 1]; for (row = 1; row
static int RowSum(int row) { int col, rowSum = 0;
for (col = 1; col
static int ColSum(int col) { int row, colSum = 0;
// Fill in missing code return colSum; }
static int MatrixSum() { int row, col; int matrixSum = 0;
// Fill in missing code return matrixSum; }
static void CloseFiles() { fileIn.Close(); fileOut.Close(); } } // End application class } // End namespace -------------------------------------------------------
//MatrixDat.txt
3 Matrix One 5 7 45 38 5 56 18 34 4 87 56 23 41 75 87 97 45 97 86 7 6 8 85 67 6 79 65 41 37 4 7 76 57 68 8 78 2 Matrix Two 6 8 45 38 5 56 18 34 4 30 87 56 23 41 75 87 97 49 45 97 86 7 6 8 85 77 67 6 79 65 41 37 4 53 7 76 57 68 8 78 2 14 21 18 46 99 17 3 11 73 Matrix Three 6 6 45 38 5 56 18 34 87 56 23 41 75 87 45 97 86 7 6 8 67 6 79 65 41 37 7 76 57 68 8 78 21 18 46 99 17 3
------------------------------
//MatrixRpt.txt
-----------------------
..
Design and implement a C# program that will input the definition of a sequence of matrices from a file named MatrixDat.Txt. For each matrix, calculate and display the sum of the elements in each row and each column, as well as the entire matrix. A sample report is displayed below. The report should be written to a file named MatrixRpt. Txt. . | Generate Matrix Row and Column Sums Class: Purpose: Programmer: Date: 01/27/2018 41 Matrix One (5 x 7) ** * 45 38 5 56 18 34 4 * 200** 87 56 23 75 87 97 * 466 * * 45 97 86 7 6 8 85 * 334 * * 67 6 79 65 41 37 4 * 299* * 7 76 57 8 78 2 * 296 * *: 251 273 250 237 148 244 192 * 1595 * 68 Matrix Two (6 x 8) * **** * 45 38 * 87 56 * 45 97 * 67 6 * 7 76 21 18 * * 272_291 : 5 23 86 79 57 46 56 41 7 65 68 99 18 75 6 41 8 17 34 87 8 37 78 3 4 97 85 4 2 11 30 * 230 * 49 * 515 * 77 * 411 * 53 * 352 * 14 * 319 * 73 * 288 * 296 * 2106 # * 296 336 165 247 203 Matrix Three (6 x 6) : 45 38 5 56 18 34 * 196 * * 87 56 23 41 75 87 * 369 * * 45 97 86 7 6 8 * 249 * * 67 6 79 65 41 37 * 295 * 7 76 57 68 8 78 * 294 * * 21 18 46 99 17 3 * 294 * *** 272 291 296 336 165 247 * 1607 * * ***Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started