Question: 1) Code a method named eye that takes as input a positive integer d and prints out an identity matrix of size (dxd). An identity

 1) Code a method named eye that takes as input a

1) Code a method named eye that takes as input a positive integer d and prints out an identity matrix of size (dxd). An identity matrix is defined as a matrix with 1s on the diagonal and 0s everywhere else. For example, if the user enters 3 , your program should print out the matrix: 100010001 The method does not return anything. Hint: Use nested loops. 2) Code a method named findMyString that takes two input variables, arr and key. Assume that the key is only a single String and that arr is an array of Strings of any length. Your method should search for key in arr and returns the first position (index) of its appearance in the array. In the case the key is not found, your output should be 1. 3) Code a method called reverseArrayToArrayList that turns any array into an ArrayList and returns it in the reverse order (without using any built-in Java support for this). Provide an example that proves your code works. Test all your methods in your main appropriately

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!