Question
import java.util.Arrays; /** * A simple recursive method to find the largest value in a list, * and a main program to test it. */
import java.util.Arrays;
/** * A simple recursive method to find the largest value in a list, * and a main program to test it. */ public class TemplateLab10Bronze { public static void main(String[] args) { double[] test = {2.3,5.6,9.8,6.5,7.2,4.4}; System.out.println("The largest element of the array "+Arrays.toString(test)+ " is "+largestInList(test.length,test)); test = new double[]{1.1}; System.out.println("The largest element of the array "+Arrays.toString(test)+ " is "+largestInList(test.length,test)); }//main //******Add your method here****** public static double largestInList(int n, double[] list){ return 0; } }
A simple recursive summation 1. Start with the file TemplateLab10Bronze.java 2. Add a recursive method double largestInList (int n, double[] list) which will find the largest of the first n elements of the array of doubles list. Assume n is between 1 and list.length. You must use recursion to do this no loop of any kind is allowedStep by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started