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

Write a Java programmethod named reversal that returns a new array that is a rev

ID: 3618625 • Letter: W

Question

Write a Java programmethod named reversal that returns a new array that is a reversalof the original array. Use [5.0, 4.4, 1.9, 2.9, 3.4, 3.5] to testthe method. Also, the reversal method is to send the minimum itemof the array.

Output Sample:

Original Array is: 5.0 4.41.9 2.9 3.4 3.5 The Reversal is: 3.5 3.4 2.9 1.9 4.4 5.0 TheMinimum item: 1.9

Public class reverse
{
   public static void main (string args[])
   {

    doublea[]={5.0,4.4,1.9,2.9,3.4,3.5},result;
    result=reversal (a,6);
     for(int 1=0;i<6;i++);
     System.out.print(a[i]+"");
    System.out.printIn("minimum item:"+result);
    System.exit(0)
    }
   public static double reversal (double x[], int n)
   {

      int i;
      double []rev=new double[n];
      double min;
      System.out.printIn("outputsample");
      System.out.printIn("Original Arrayis:");
      int j=0;
     for(i=n-1;>=0;i--)     
      {
        rev[j]=x[i];j++;
      }
      System.out.printIn("The Reversalis:");
      for(i=0;i<n;i++)
      {
         x[i]=rev[i];;
      }

      min=x[0];
      for(i=1;i<n;i++)
      {
        if(min>x[i])
         {
           min=x[i]
           }
         }
         return (min);
     }
}

Explanation / Answer

please rate - thanks //Assignment Name: - Assignment5.2TestReversal.java //Write a Java program method named reversal that returns a newarray that is a reversal of the original array. import java.io.*; import javax.swing.JOptionPane; public class reverse {public static void main (String args[])    {double a[]={5.0,4.4,1.9,2.9,3.4,3.5},result;     result=reversal (a,6);   //reversearray and get smallest value     for(int i=0;i
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