Question: B2. (15 marks) a) Write Java code fragment for handling 2D array, as required below: o Write only one statement to declare and create a

 B2. (15 marks) a) Write Java code fragment for handling 2D

B2. (15 marks) a) Write Java code fragment for handling 2D array, as required below: o Write only one statement to declare and create a variable dArr of 2D array of double, with 3 rows and 6 columns. Further write a nested for loop, to set each element in the 2D array with the result value of the summation of its two index numbers. [4 marks) b) Given a class BClass with a constructor which accepts one argument of int type) representing certain identity code, write Java code fragment as required below: o Write one statement to only declare a variable bArr of type BClass array. o Then, write multiple statements to create an array of BClass having the size of your student ID number and assign this array to the variable above. Each element in this array refers to a unique instance having its index number in the array as its identity code [4 marks] C c) Write a public static method getFirstD() with the following: o The method accepts 2 arguments: the first argument is an array of int, and the second is a value of int. The method returns a value of int type. o The method finds and returns the last element in the array which is divisible by the second argument, e.g. 8 is divisible by 4, but I is not divisible by 4. The method returns your student ID number, if no divisible number is found in the array. o Use a while loop to access the array elements. * NO more than 6 statement lines are allowed in the method body. 17 marks/ Op Man meman

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!