Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

fix so it compiles, and call recursive helper methods private boolean inProgramRecursive(StudentNode cur, String program) return false; // so it compiles public Student getStudent(String SID)

fix so it compiles, and call recursive helper methods image text in transcribed
image text in transcribed
private boolean inProgramRecursive(StudentNode cur, String program) return false; // so it compiles public Student getStudent(String SID) { return getStudentRecursive(head, SID); } private Student getStudentRecursive(StudentNode cur, String SID) { return null; // so it compiles } public double averageGPA() { if (size() e) { return 0.0; } else { return sumGPARecursive (head)/size(); } } private double sumGPARecursive(StudentNode cur) { return 0.0; // so it compiles } public double programaverage(String program) { // call a recursive helper method! return 0.0; } public Student highestGPA() { // call a recursive helper method! return null; } public class A4Exercises { 1 2 3 4 5 6 7 8 9 10 11 12 13 Purpose: add valToAdd to all elements in the given array * Parameters: int[] array - the array to modify int valToAdd - the value to modify items by * Returns: void - nothing */ public static void addToA11(int[] array, int valToAdd) { addToAllRecursive array, valToAdd, array.length-1); } private static void addToAllRecursive(int[] array, int valToAdd, int i) { 14 } 15 16 17 18 19 20 21 22 23 24 Purpose: determines whether the given array contains toFind Parameters: int[] array - the array to search int toFind - the value to search for Returns: boolean - true if found, false otherwise */ public static boolean arraycontains(int[] array, int toFind) { return arrayContainsRecursive(array, toFind, array.length-1); 25 26 27 private static boolean arraycontainsRecursive(int[] array, int toFind, int i) { return false; // so it compiles } */ 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 * Purpose: gets the number of times there are two of the same element in a row * Parameters: int[] array - the array to search Returns: int - the number of occurrences where two adjacent elements are the same public static int sameInARow(int[] array) { return same InRowRecursive(array, -1, array.length-1); } private static int sameInAROWRecursive(int[] array, int prev, int i) { return 0; // so it compiles }

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Securing SQL Server Protecting Your Database From Attackers

Authors: Denny Cherry

3rd Edition

0128012757, 978-0128012758

More Books

Students also viewed these Databases questions