Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Hello, Please help in Java. Use ArrayLists, no bufferedReader. You have a file with multiple results from a local survey. Supposed you already wrote two

Hello, Please help in Java.

Use ArrayLists, no bufferedReader.

You have a file with multiple results from a local survey. Supposed you already wrote two classes:

-SurveyData class with fields: String name, String occupation, String location, int age, double score

-SurveyStats class with fields: int count, int day, int[] years

Created ArrayLists for both classes

//TODO - write a method using binary search for ArrayList that takes name, occupation and city from SurveyData class and returns statistics list using the SurveyStats class. Use an additional ArrayList, do a backward search to return the first occurence of data. Return null if not found. Incorporate this sample code for binary search but modify to match the given method start.

public SurveyStats getStats(String name, String location, String occupation)

image text in transcribed

- write a method that takes an array of the readings from SurveyData class and returns the slope of best fit line. Use x for age and y for score.

public double calcSlope(Readings[] surveyReadings)

public static int binarysearch(int [] a, int target) \{ int min =0; int max = a.length 1; while (min target) \{ max =mid1; else \{ return mid

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

Oracle RMAN For Absolute Beginners

Authors: Darl Kuhn

1st Edition

1484207637, 9781484207635

Students also viewed these Databases questions

Question

What is the p-value provided for the explanatory variable?

Answered: 1 week ago