Question: Which throws clause specifies the minimum required exception types for the filterTimeData method? public static double [ ] filterData ( Scanner scnr , int numValues,

Which throws clause specifies the minimum required exception types for the filterTimeData method?
public static double[] filterData(Scanner scnr, int numValues, double lowThreshold, double highThreshold) throws Exception {
double inputVal;
double[] resultArray = new double[numValues];
for (int i =0; i < numValues; ++i){
inputVal = scnr.nextDouble();
if (inputVal <0.0){
throw new Exception("Invalid negative time");
}
if ((inputVal >= lowThreshold) && (inputVal <= highThreshold)){
resultArray[i]= inputVal;
}
}
return resultArray;
}
public static double[] filterTimeData(String fileName, double lowThreshold, double highThreshold){
FileInputStream inStream = new FileInputStream(fileName);
Scanner fileScnr = new Scanner(inStream);
int numValues = fileScnr.nextInt();
return filterData(fileScnr, numValues, lowThreshold, highThreshold);
}
Question 6 options:
throws FileNotFoundException, Exception
throws Exception, InputMismatchException
throws Exception
throws FileNotFoundException

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!