Just an part of an exam question for basic java having trouble with
What does the following code do?
(I think this is what the code does)The code puts the values 0,2,4 and 6 into the formula x*x+b*x+1 and outputs a value for y each time.
Give an example of the code to call the doIt method where the parameter b is 4 and the array contains the elements 0,2,4,6.
Havent a clue here
Complete the actual output produced(use a character or space per cell)
y(0,4) is 1
y(2,4) is 13
y(4,4) is 33
y(6,4) is 61
class Dowhat
public static void doIt(int b, int[] array)
for(int x: array)
int y=x*x+b*x+1
System.out.printf("y(%2d,%2d) is %3d\n",x,b,y);
//end method doIt
//end class DoWhat
Just a bit of help needed.Am i right for the first and third question and how would you do the second question? Any help appreciated!
