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

// guys how come my program is not printing the. I also don\'tunderstand why it

ID: 3615202 • Letter: #

Question

// guys how come my program is not printing the. I also don'tunderstand why it is not printing the last 5 values of my array Theother thing is how can l make it print every tenth element of thearray.

public class lab9
{
    public static void main (String [] args )
    {



        int a [] = new int[100];

        randomArray(a);




    }




    public static int [] randomArray (int a [] )

    {
           int [] random= a;

          for ( inti=0; i<random.length;i++)
          {
          random [i]=(int)(Math.random()*10)+1;
    }

    return random;
}

     public static void printFirst10 (int[]a){
             System.out.println ("The the last five values of thearray:");
             for (int i=95; i<100; i++)
                 System.out.println (a[i]);
             System.out.println ();
        }

}


Explanation / Answer

please rate - thanks you never called the method to print--I added a new method to printevery tenth element 0,10,20,... just increment the loop by 10 public class lab9 { public static void main (String [] args )     { int a [] = new int [100];         randomArray(a);          printFirst10( a);          printEveryTenth(a);     }     public static int [] randomArray (int a [] )     {            int []random = a;           for ( inti=0; i