Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

image text in transcribed

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

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Flash XML Applications Use AS2 And AS3 To Create Photo Galleries Menus And Databases

Authors: Joachim Schnier

1st Edition

0240809173, 978-0240809175

More Books

Students also viewed these Databases questions