Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

End 20 points) Write a recursive method called findTarget that checks and returns true if a target value is found among the first num integers

image text in transcribed
End 20 points) Write a recursive method called findTarget that checks and returns true if a target value is found among the first num integers in an array and false otherwise. The method takes 3 parameters: - intList, anon-empty array of integers - target, an integer - num, a positive integer, no more than size of array, representing number of elements to analyze in array. For example, int a-(13, 22, 3, 44, 25): System.out.printin (findTarget (a, 3,5)): //will print true System.out.printin (findTarget (a, 3,2)): //will print false 12. (20 points) Given the Car (a number 0-5): class defined by the car year/make/model as well as the overall safety star rating public class Car ( private int rating: public Car (int stars)( rating-stars; public int getSafetyRating () ( return rating; public void setSafetyRating (int stars) ( rating=stars: Rale.bud abstra Write a method analyzeCars that takes two parameters: - numCars, an integer - numYears, an integer The method creates and populates a two-dimensional array of numCars Car objects with ratings for the past. numYears years. The rating for each car is a integer, 0-5, inclusive. The method returns an array of doubles containing the average cars rating for every year in the past numYears years. For example, if the following shows the ratings for 5 cars in the past 3 years: 3, 4, 5, 4, 4 2, 5, 5, 4, 4 1, 4, 4, 3, 4 the returned averages array will contain 4.0, 4.0, 3.2

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

Students also viewed these Databases questions