Question
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)
- 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 midStep 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