Assignment1 CS 228 Assignment 1 100 points Introduction This programming project will require you to create classes that read and manipulate arbitrary data and then use these classes to process...

.


Assignment1 CS 228 Assignment 1 100 points Introduction This programming project will require you to create classes that read and manipulate arbitrary data and then use these classes to process climate data. This data will be posted so that you may use it to test your programs. The primary purpose of this assignment is to cement concepts that were taught in ComS 227, learn and use JavaDoc with good documentation practices, create JUnit 5 test code, write a generic class, and continue learning to use good object oriented practices. Although 3 weeks are given to complete this assignment, it should be easily be completed in a week. Please start early as other assignments will be assigned in parallel with this one, and remember that if it does not work on simple test cases that will be automatically run each day for you starting a few days after the assignment is given, then it will receive zero credit. Generic Statistics Classes The StatObject class The first part of this assignment is to write several statistical functions using objects and the “StatObject” interface. The objects you are required to implement must all implement that “StatObject” interface, and are listed below. All of these objects and interfaces must reside in the “cs228hw1.stats” package. Average.java Median.java Minimum.java Maximum.java StdDeviation.java Histogram.java When implementing these classes please follow the JavaDoc comments in the interface for implementing the interface methods. In addition, specific details for each class are given below. Note that all of these implementations must have a default constructor, in addition to any other constructors specified below. Specific implementation details Average.java  The GetResult method returns the average of all numbers in the data object.  If the data object is null or contains no elements that a RuntimeException indicating this.  A specific constructor with an appropriate ArrayList parameter that copies the data from the parameter to the data object within the class itself. Median.java  The GetResult method returns the median of all the numbers in the data object. The median is computed differently depending of the number of data items is odd or even. See https://www.mathsisfun.com/median.html or many other web sites for the correct computation of median.  If the data object is null or contains no elements that a RuntimeException indicating this.  A specific constructor with an appropriate ArrayList parameter that copies the data from the parameter to the data object within the class itself. Minimum.java  The GetResult method returns the minimum of all numbers in the data object.  If the data object is null or contains no elements that a RuntimeException indicating this.  A specific constructor with an appropriate ArrayList parameter that copies the data from the parameter to the data object within the class itself. Maximum.java  The GetResult method returns the maximum of all numbers in the data object.  If the data object is null or contains no elements that a RuntimeException indicating this.  A specific constructor with an appropriate ArrayList parameter that copies the data from the parameter to the data object within the class itself. StdDeviation.java  The GetResult method returns the standard deviation of all numbers in the data object. Here is one of many web sites that explains how calculate the sample standard deviation. https://www.khanacademy.org/math/statistics-probability/summarizing-quantitative- data/variance-standard-deviation-sample/a/population-and-sample-standard-deviation-review  If the data object is null or contains no elements that a RuntimeException indicating this.  A specific constructor with an appropriate ArrayList parameter that copies the data from the parameter to the data object within the class itself. Histogram.java  A specific constructor with an appropriate ArrayList parameter that copies the data from the parameter to the data object within the class itself.  The GetResult method returns an ArrayList of integral values that are the bins of the histogram. The value ranges of the bins are set via other methods below. A RuntimeException is thrown if the histogram is not valid for any reason. Note that a histogram can be valid for zero data elements, but is invalid if the MinRange is greater than the MaxRange value below.  A method named “SetNumberBins” that sets the number of equal size bins in the histogram. If this method is not called then the default value is 10.  A method named “GetNumberBins” that returns the current number of bins set.  Note that the min and max range values set below are type dependent. Be sure use the correct generic type.  A method named “SetMinRange” sets the lowest value at which data is included in the lowest bin. Data that is less than this value is not placed in any bin if GetResult is called. The default is negative infinity.  A method named “GetMinRange” that returns the current MinRange value.  A method named “SetMaxRange” sets the highest value at which data is included in the highest bin. Data that is greater or equal than this value is not placed in any bin if GetResult is called. The default is positive infinity.  A method named “GetMaxRange” that returns the current MaxRange value.  If a data value falls exactly on the dividing line between two bins, it is placed in the higher value bin. For example, if the data is integer type and two bins range from 0 to 3 and 3 to 6, then a data value of 3 would be placed in the 3 to 6 range bin. Note that if the data value is on the right end point of the largest bin, it should be placed in the largest bin. The Statistics class Implement the Statistics in a file named “StatisticsShell.java” that resides in the “cs228hw1.stats” package. Use the JavaDoc comments as the specification. The StatisticsShell class must contain at least one of the following two specific constructors. One takes a single parameter of type IParser. The other takes a single parameter of type Method. A Simple Client Write a program in the file named “Weather.java” that resides in the “cs228hw1” package (not the cs228hw1.stats package) that reads a data file given as the first argument on the command line. The file is a weather file that is easily generated from NOAA, and an example file is given in the assignment on Canvas. Your job is to utilize the statistics package you created to output the following. The monthly high temperature and the monthly low temperature for each month in the data. The average temperature for each day. The median temperature for each day. A Histogram of high temperatures for each day with 15 bins ranging from -40 to 110 degrees. Junit Tests You are not required to write tests, but you are highly encouraged to write Junit tests and share them with the class.
Sep 23, 2021
SOLUTION.PDF

Get Answer To This Question

Related Questions & Answers

More Questions »

Submit New Assignment

Copy and Paste Your Assignment Here