(Solved) : 1 Write Java Class Called Seismicanalysis Class File Called Seismicanalysisjava 2 Seismica Q44100735 . . .
1. Write a Java class called SeismicAnalysis in a class filecalled SeismicAnalysis.java.
2. The SeismicAnalysis class contains a single attribute; anArrayList of type Double named measurements.
3. Write the following methods as members of the SeismicAnalysisclass:
a. A lone constructor that takes one argument, a String calledfilename. The constructor opens and reads from the binary data file(NOT a text file) specified by filename storing the results in themeasurements attribute. If the file does not exist or is corrupted,then the method throws the AnalysisException (see below); this isdone by first catching the IOException and then throwing theAnalysisException.
b. A public method called countAbove(). This method takes oneargument, a double value called threshold. This method returns anint value for the number of elements in measurements that exceedthe value of threshold. It performs this by calling a privatehelper method (which you also need to define) that uses headrecursion to traverse the values of the measurementsattribute.
c. A public method called countBelow(). This method takes oneargument, a double value called threshold. This method returns anint value for the number of elements in measurements that are lessthan the value of
threshold. It performs this by calling a private helper method(which you also need to define) that uses tail recursion totraverse the values of the measurements attribute.
4. To make sure that your implementation is working correctly, youneed to create an AnalysisException class as an extension of aRuntimeException. This exception needs to be thrown if a problemoccurs when reading data from a file. Create a file calledAnalysisException.java containing the following code:
public class AnalysisException extends RuntimeException {
public AnalysisException(String s) {
super(s);
}
}
Expert Answer
Answer to 1. Write a Java class called SeismicAnalysis in a class file called SeismicAnalysis.java. 2. The SeismicAnalysis class c…
OR