Today, I will show you a simple Statistics Calculator Java program that allows the user to input any numbers then the program will display the total counts or number inputted, sum of all the numbers, the smallest and largest number, the average and its Standard Deviation.
Here, I used the implementation of polymorphism using different methods, with or without parameters (setting and getting), passing of variables, creating of object and the relationship of classes (inheritance).
The Design:
In designing the program, I create two classes: SimpleStatistics (the main program/class) and StatisticsCalculator (the subclass). The main program will served as the trigger to display the output of the program while the subclass is where we place the algorithm in setting and getting the data by passing it to the different methods we are going to create. The broken line indicates a relationship of each two classes where the subclass inheriting some attributes of the main class.
The image below is an example of the output dialog of the program. Lets see how this program works.