Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Using Java codes make a program that creates and uses a loop to populate a one-d

ID: 3553354 • Letter: U

Question

Using Java codes make a program that creates and uses a loop to populate a one-dimensional array that holds the even numbers between 1 and 12; creates and uses a loop to populate a second one-dimensional array that holds the odd numbers between 1 and 12; creates a two-dimensional array that holds the values of the products of the two one-dimensional arrays. Example...the the value of [0][0] in the two dimensional array should be the value of the the [0] subscript in the even array multiplied by the [0] subscript in the odd array. The value of the [1][1] spot in the two dimensional array should be the value of the [1] subscript in the even array multipled by the [1] subscript in the odd array. Output the values of the two dimensional array to the screen in an organized fashion so it is clear which values are which. Remember, you need to show as output the entire multiplication table...a total of 36 values. Something like the following:


1 3 5 7 9 11 2 2 6 10 14 18 22 4 4 12 20 28 36 44 6 6 18 30 42 54 66 8 8 24 40 56 72 88 10 10 30 50 70 90 110 12 12 36 60 84 108 132

Explanation / Answer

public class Mult {

02

public static void main(String[] args){

03

  

04

  

05

int even[] = new int[6];

06

int odd[] = new int[6];

07

int[][] M = new int[6][6];

08

  

09

  

10

  

11

  

12

for (int i = 1; i <= 12; i++){

13

if(i%2==0){

14

even[i / 2 - 1] = i;

15

}

16

else {

17

odd[i / 2] = i;

18

}

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote