Question: 8) Write a segment of code (not a whole program) that sets the elements of a two-dimensional (10 by 10) array called map as follows:

8) Write a segment of code (not a whole program) that sets the elements of a two-dimensional (10 by 10) array called map as follows: the top and bottom rows and the left-most and right-most columns contain the value 0, all other elements (the "inside" ones) contain the value 99.

9) Write a class called Squares that reads in 50 positive or negative whole numbers from a file (e.g., 5, 946, -32, 0) and prints out only those numbers that are perfect squares (a number N is a perfect square if there is some positive whole number S such that S*S = N). For example, 0,1,4,9,16,25,36, etc. are perfect squares. 2,3,5,6,7,8,10 etc. are not perfect squares. The program MUST use a non-static method to decide if a number is a perfect square. The main method should just read a number, call the function, then print the number if the function indicates it is a perfect square.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!