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

public class ArrayExpQuickQuiz { public static void main(String[] args) { // ple

ID: 3719814 • Letter: P

Question

public class ArrayExpQuickQuiz {

   

    public static void main(String[] args) {

// please Enter your code here to complete the application, it has to be written here, I want it to be on the main method. I can only use 2 methods on this class which is the mani method and printArray method.

   

    }

    public static void printArray(int[] array)

    {

        for (int index = 0; index < array.length; index++)

       

            System.out.printf(" %d ",array[index]);

       

        System.out.println();

       

    }

Output: MyGradesArra 87 90 78 92 96 82 CopyMyGrades 87 90 78 92 96 82 New MyGradesArray Completed Expansion of MyGradesArra? 87 90 78 92 96 82 0 0 0 0

Explanation / Answer

ArrayExpQuickQuiz.java

public class ArrayExpQuickQuiz {

public static void main(String[] args) {

// please Enter your code here to complete the application, it has to be

// written here, I want it to be on the main method. I can only use 2

// methods on this class which is the mani method and printArray method.

int grades[] = {87,90,78,92,96,82};

System.out.println("MyGradesArray: ");

printArray(grades);

int copyGrades[]=new int[grades.length];

for(int i=0;i<copyGrades.length;i++){

copyGrades[i]=grades[i];

}

System.out.println("CopyMyGrades:");

printArray(copyGrades);

int newGrades[] = new int[10];

System.out.println("New MyGradesArray");

printArray(newGrades);

for(int i=0;i<grades.length;i++){

newGrades[i]=grades[i];

}

System.out.println("Completed Expansion of MyGradesArray:");

printArray(newGrades);

}

public static void printArray(int[] array)

{

for (int index = 0; index < array.length; index++)

System.out.printf(" %d ", array[index]);

System.out.println();

}

}

Output:

MyGradesArray:
87 90 78 92 96 82
CopyMyGrades:
87 90 78 92 96 82
New MyGradesArray
0 0 0 0 0 0 0 0 0 0
Completed Expansion of MyGradesArray:
87 90 78 92 96 82 0 0 0 0