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

Write the program in MIPS that declares an array of positive integers. The size

ID: 3921456 • Letter: W

Question

Write the program in MIPS that declares an array of positive integers. The size of the array is not fixed. The final element of the array should have the value of 0xF, which is not used in calculations, and should be used to calculate the size of the array. The program can prompt the user for an integer input. Compare the input with the array. Display the index of the input in the array if found. If the number does not match any element in the array, insert the number in the array in sorted order. The program is terminated when input a negative integer. Print the new array with appropriate message on the screen. For example assume an array as follows:

(array: .word 4, 5, 23, 5, 8, 3, 15, 67, 8, 9, 0xF)

Sorted array: 3, 4, 5, 5, 8, 8, 9, 15, 23, 67

Enter a number to search: 20

Number not found. Added to array.

Sorted array: 3, 4, 5, 5, 8, 8, 9, 15, 20, 23, 67

Enter a number to search: 5

Number at index 2

Explanation / Answer

import java.util.Scanner;
public category Ascending _Order

for (int i = 0; i < n; i++)
temporary worker = a[i];
a[i] = a[j];
a[j] = temp;
}
}
}
System.out.print("Ascending Order:");
for (int i = 0; i < n - 1; i++)
  

import java.util.Scanner;
public category Ascending _Order

for (int i = 0; i < n; i++)
temporary worker = a[i];
a[i] = a[j];
a[j] = temp;
}
}
}
System.out.print("Ascending Order:");
for (int i = 0; i < n - 1; i++)
import java.util.Scanner;
public category Ascending _Order

for (int i = 0; i < n; i++)
temporary worker = a[i];
a[i] = a[j];
a[j] = temp;
}
}
}
System.out.print("Ascending Order:");
for (int i = 0; i < n - 1; i++)
import java.util.Scanner;
public category Ascending _Order

for (int i = 0; i < n; i++)
temporary worker = a[i];
a[i] = a[j];
a[j] = temp;
}
}
}
System.out.print("Ascending Order:");
for (int i = 0; i < n - 1; i++)
  

import java.util.Scanner;
public category Ascending _Order

for (int i = 0; i < n; i++)
temporary worker = a[i];
a[i] = a[j];
a[j] = temp;
}
}
}
System.out.print("Ascending Order:");
for (int i = 0; i < n - 1; i++)
import java.util.Scanner;
public category Ascending _Order

for (int i = 0; i < n; i++)
temporary worker = a[i];
a[i] = a[j];
a[j] = temp;
}
}
}
System.out.print("Ascending Order:");
for (int i = 0; i < n - 1; i++)
import java.util.Scanner;
public category Ascending _Order

for (int i = 0; i < n; i++)
temporary worker = a[i];
a[i] = a[j];
a[j] = temp;
}
}
}
System.out.print("Ascending Order:");
for (int i = 0; i < n - 1; i++)
import java.util.Scanner;
public category Ascending _Order

for (int i = 0; i < n; i++)
temporary worker = a[i];
a[i] = a[j];
a[j] = temp;
}
}
}
System.out.print("Ascending Order:");
for (int i = 0; i < n - 1; i++)
import java.util.Scanner;
public category Ascending _Order

for (int i = 0; i < n; i++)
temporary worker = a[i];
a[i] = a[j];
a[j] = temp;
}
}
}
System.out.print("Ascending Order:");
for (int i = 0; i < n - 1; i++)
import java.util.Scanner;
public category Ascending _Order

for (int i = 0; i < n; i++)
temporary worker = a[i];
a[i] = a[j];
a[j] = temp;
}
}
}
System.out.print("Ascending Order:");
for (int i = 0; i < n - 1; i++)
import java.util.Scanner;
public category Ascending _Order

for (int i = 0; i < n; i++)
temporary worker = a[i];
a[i] = a[j];
a[j] = temp;
}
}
}
System.out.print("Ascending Order:");
for (int i = 0; i < n - 1; i++)
import java.util.Scanner;
public category Ascending _Order

for (int i = 0; i < n; i++)
temporary worker = a[i];
a[i] = a[j];
a[j] = temp;
}
}
}
System.out.print("Ascending Order:");
for (int i = 0; i < n - 1; i++)
  

import java.util.Scanner;
public category Ascending _Order

for (int i = 0; i < n; i++)
temporary worker = a[i];
a[i] = a[j];
a[j] = temp;
}
}
}
System.out.print("Ascending Order:");
for (int i = 0; i < n - 1; i++)
import java.util.Scanner;
public category Ascending _Order

for (int i = 0; i < n; i++)
temporary worker = a[i];
a[i] = a[j];
a[j] = temp;
}
}
}
System.out.print("Ascending Order:");
for (int i = 0; i < n - 1; i++)
import java.util.Scanner;
public category Ascending _Order

for (int i = 0; i < n; i++)
temporary worker = a[i];
a[i] = a[j];
a[j] = temp;
}
}
}
System.out.print("Ascending Order:");
for (int i = 0; i < n - 1; i++)
import java.util.Scanner;
public category Ascending _Order

for (int i = 0; i < n; i++)
temporary worker = a[i];
a[i] = a[j];
a[j] = temp;
}
}
}
System.out.print("Ascending Order:");
for (int i = 0; i < n - 1; i++)
import java.util.Scanner;
public category Ascending _Order

for (int i = 0; i < n; i++)
temporary worker = a[i];
a[i] = a[j];
a[j] = temp;
}
}
}
System.out.print("Ascending Order:");
for (int i = 0; i < n - 1; i++)
import java.util.Scanner;
public category Ascending _Order

for (int i = 0; i < n; i++)
temporary worker = a[i];
a[i] = a[j];
a[j] = temp;
}
}
}
System.out.print("Ascending Order:");
for (int i = 0; i < n - 1; i++)
import java.util.Scanner;
public category Ascending _Order

for (int i = 0; i < n; i++)
temporary worker = a[i];
a[i] = a[j];
a[j] = temp;
}
}
}
System.out.print("Ascending Order:");
for (int i = 0; i < n - 1; i++)
import java.util.Scanner;
public category Ascending _Order

for (int i = 0; i < n; i++)
temporary worker = a[i];
a[i] = a[j];
a[j] = temp;
}
}
}
System.out.print("Ascending Order:");
for (int i = 0; i < n - 1; i++)
import java.util.Scanner;
public category Ascending _Order

for (int i = 0; i < n; i++)
temporary worker = a[i];
a[i] = a[j];
a[j] = temp;
}
}
}
System.out.print("Ascending Order:");
for (int i = 0; i < n - 1; i++)