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

I need help with writing a java program that finds the greatest product of four

ID: 3542490 • Letter: I

Question

I need help with writing a java program that finds the greatest product of four consecutive numbers in any direction (up, down, left, right, or diagonal) in the 20x20 matrix or grid of numbers.

The 20x20 matrix of numbers can range from 00-99 and have to be inputed from a input.txt file.

1.Your program should contain at least one two dimensional array
2. Your program should not use any global variables
3. Your program should contain at least three TWO static methods. One for accepting the data from keyboard, one for printing the final results to console and one other function that is used during your calculations

The final results should consist of the (i,j) index of each of the four numbers. The next line should print the numbers and the final product of the four.

Explanation / Answer

using System; using System.IO; namespace euler1 { class Problem11 { public static void Main(string[] args) { new Problem11().Solve(); } public void Solve() { string filename = Environment.GetFolderPath(Environment.SpecialFolder.DesktopDirectory) + "\input.txt"; const int numbersInProduct = 4; DateTime startTime = DateTime.Now; decimal product = 0; int[,] inputSquare = readInput(filename); for (int col = 0; col