Print the initial array and the resulting array

Assignment Help JAVA Programming
Reference no: EM13712071

You need to prepare a matrix.

Program- Take an N x N matrix, and create a new, (N-1) x (N- 1), matrix with each element being the sum of four nearby elements. You need to figure out a way to break the matrix up into squares and iterate through the matrix, while staying within its bounds. For example:

0 1 2

3 4 5

6 7 8

Result:

8 12

20 24

You have to implement an iterative calculate_result() function that takes the original N x N array and fills the result array with the correct sum of the four neighboring elements, and also, you require a recursive_calculate_result() function that does the same thing as calculate_result but recursively.

Requirements for your program:

-  Read the N value from the user

- Initialize the N x N array

- Print the initial array and the resulting array

- All functions (including main) must not be more than 15 lines of code!!!

Can someone please help me. I don't know what to do to write this C program.

Reference no: EM13712071

Questions Cloud

What is the mass of the star it orbits around : Two planets P1 and P2 orbit around a Star S in circular orbits with speeds v1=42.86 km/s, and v2=56.2 km/s respectively.
What would be the pseudocode and flowchart : What would be the pseudocode and flowchart for this problem? BTW it shows Fibonacci numbers below 100.
Find how many strings in a have exactly three 5s : Let A be the set of all strings of decimal digits of length five. For example, 00312, 99999, and 19483 are strings in A.
Create a gui message panel that uses 4 different fonts : Create a GUI message panel that uses 4 different fonts, colors and styles ( bold ect ) with messages of your choice.
Print the initial array and the resulting array : Take an N x N matrix, and create a new, (N-1) x (N- 1), matrix with each element being the sum of four nearby elements. You need to figure out a way to break the matrix up into squares and iterate through the matrix, while staying within its bound..
Splay tree and show the resulting tree : Insert 5, 1, 3, 6, 2, 4 into an initially empty splay tree and show the resulting tree - Can you provide some help with my Java language project? I hope someone nice out there can help me with it.
Write class encapsulating the concept of weather forecast : Write a class encapsulating the concept of the weather forecast, assuming that it has the given attributes: the temperature and the sky conditions, which could be sunny, snowy, cloudy, or rainy.
Computes a students grade for an assignment : Write a C++ program that computes a student's grade for an assignment as a percentage given the student's score and total points.
Construct minimal avl trees of height : Construct minimal AVL trees of height 0, 1, 2, 3, and 4. you do not need to fill in the values, just draw the structure of the tree. Tip: Use the recursive definition for the number of nodes in a minimal AVL tree.

Reviews

Write a Review

JAVA Programming Questions & Answers

  How to count number of objects (instances) created

How to count number of objects (instances) Created, use java code and please be descriptive

  Cognitive-based approaches to understanding motivation

Compare and contrast the need-based and cognitive-based approaches to understanding motivation?

  Discussion htmlcssjavascript placementnbspplease respond to

discussion htmlcssjavascript placementnbspplease respond to the followingcompare and contrast the process of adding

  Generates a random number between 1 and 100

Write a program that generates a random number between 1 and 100 (inclusive) and then prompts the user to guess the number. The user should be given up to 10 chances to guess the number.

  Describe different professional levels in this discipline

What is Anesthesiology and critical care medicine describe the specific discipline, what is their focus (i.e., emergency medicine, education and prevention, psychiatric treatment etc.) Describe the different professional levels in this discipline

  Design a program that extends the definition of the class

Design a program that extends the definition of the class JFrame to display a window on the screen. Name your class PropertyTax1, title your window "Calculation of Property Taxes," set the window's width to 400 pixels and height to 300 pixels, and te..

  Prepare a java program to create a bank account

Write a client java program that will use a pre-implemented class BankAccount.java. BankAccount class provides template to create BankAccount objects that represent real world bank accounts

  Write a recursive method called maxsum

write a recrusive method called maxSum that accepts a list of integers. L, and an integer limit n as parameters and use backtracking to find the maximum sum that can be generated by adding elements of L that do not exceed n.

  Modify the scholarship application

Modify the Scholarship application so that if a user enters a grade point average under 0 or over 4.0, or a negative value for either of the activities, an error message appears.

  Template files contain the message text

Template files contain the message text, together with variable fields(such as Dear [Title] [Last Name ] ...). A database (stored as a text file) contains the field values for each recipient. Use HTML as the output file format. Then design and implem..

  This assignment will focus on creating java servlets that

this assignment will focus on creating java servlets that can not only serve html to web users but also provide a web

  Digit decimal seconds counter using two 7-segment displays

Write a program that implements a two digit decimal seconds counter using two 7-segment displays.  Make this program using java programming. Make this program in simple way.

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd