Hi please help with this JAVA LANGUAGE problem Development a

Hi please help with this JAVA LANGUAGE problem.

Development assignment will call on you to implement a program from scratch. It’s an exercise in learning more about Java basics, core Java Classes and Class/ method-level modularity.

Implement a ‘runnable’ Class called “NumericAnalyzer”. Here’s the functional behavior that must be implemented.

NumericAnalyzer will accept a list of 1 or more numbers as command line arguments. The provided list of numbers does not need to be ordered (although you’ll need to display the list of numbers sorted ascendingly).

Error checking: if the user fails to pass in parameters, the program will display an error message (of your choice) and exit early.

The main() method’s String [] args argument values must be converted and assigned to a numeric/integer array.

Your program will display the following information about the numbers provided by the user:

This list of numbers provided by the user sorted ascendingly.

The size of number list (the number of numbers!)

The average or mean value.

The median - the middle value of the set of numbers sorted. (Simple Algorithm: index = the length of the array divided by 2).

The min value.

The max value.

The sum

The range: the difference between the max and min

Variance: Subtract the mean from each value in the list. This gives you a measure of the distance of each value from the mean. Square each of these distances (and they’ll all be positive values), add all of the squares together, and divide that sum by the number of values (that is, take the average of this second list).

Standard Deviation: is simply the square root of the variance.

Development guidelines:

The output should be neat, formatted and well organized – should not hurt your eyes!

Your main() method’s actions should be limited to:

gathering command line arguments

displaying error messages

creating an instance of NumericAnalyzer and invoking its top level method (e.g., “calculate()”, “display()” )

Your code should adhere to naming conventions as discussed in class.

Your implementation should embrace modularity:

Each mathematical calculation should be implemented by a separate method.

Yet another method should be responsible for displaying a sorted list of the numbers provided, and displaying all derived values above.

Your implementation should embrace reuse:

Use the java.lang.Math Class methods to calculate square roots and perform power-to values.

Solution

import java.util.ArrayList;
import java.util.Collections;

class NumericAnalyzer{
   static ArrayList<Integer> list = new ArrayList<Integer>();
   static int mean=0;
   public static void main(String args[]){
      
       int sum=0,max=0,min=0,mean=0;
      
       if(args.length==0)
       {
           System.out.print(\"Since no parameters are given so exiting from program\");
           System.exit(0);
       }  
      
       for(int i=0;i<args.length;i++){
           list.add(Integer.parseInt(args[i]));
       }
      
       SortList(list); // method to sort list
       System.out.println(\"List after sorting is \");
       printList(list); // method to print list
      
       max = list.get(0);
       min = list.get(0);
       sum = list.get(0);
       findMaxinList(list); // function to find max number in list
       findMininList(list); // function to find minimum number in list
      
       mean = findMeanOfList(list); // function to find mean of list
       System.out.println(\"The number of elements in list are \"+list.size());
       System.out.println();
       findMedian(list);
       SumOfList(list);
       Range(list);
       int variance = findVariance(list);
      
       System.out.println(\"Standard Deviation is \"+variance*variance);
   }
  
   public static int findVariance(ArrayList list1){
       int square=0;
       int sum=0;
       int variance=0;
       for(int i=0;i<list1.size();i++){
           int value = (int)list1.get(i);
           square = value-mean;
           sum = sum + square*square;
       }
       variance = sum/list.size();
      
       System.out.println(\"variance is \"+variance);
       return variance;
      
   }
   public static void findMedian(ArrayList list1){
       System.out.println(\"Median is \"+list1.get(list1.size()/2));
   }
  
   public static void Range(ArrayList list1){
       int sum=0;
       int max = (int)list1.get(0);
       int min = (int)list1.get(0);
       for(int i=1;i<list1.size();i++){
           if(max < (int)list1.get(i)){
               max = (int)list1.get(i);
           }
           if(min > (int) list1.get(i))
               min = (int)list1.get(0);
       }
       System.out.println(\"Range is \"+(max-min));
   }
  
   public static void SumOfList(ArrayList list1){
       int sum=0;
       for(int i=1;i<list1.size();i++){
           sum = sum+(int)list1.get(i);
       }
       System.out.println(\"Sum of elements in list are \"+sum);
   }
  
  
   public static int findMeanOfList(ArrayList list1){
       int sum = 0;
       for(int i=1;i<list1.size();i++){
           sum = sum+(int)list1.get(i);
       }
       System.out.println(\"Mean of elements in list are \"+sum/list1.size());
       return (sum/list1.size());
   }
  
   static void printList(ArrayList list1){
       for(int i=0;i<list.size();i++)
           System.out.print(list.get(i)+\" \");
   }
  
   static void SortList(ArrayList list1){
       Collections.sort(list1);
      
   }
  
   static void findMaxinList(ArrayList list1){
       int max=(int) list1.get(0);
       for(int i=1;i<list1.size();i++){
           if(max < (int)list1.get(i)){
               max = (int)list1.get(i);
           }
       }
       System.out.println(\"Max number from list is \"+max);
   }
  
   static void findMininList(ArrayList list1){
       int min=(int) list1.get(0);
       for(int i=1;i<list1.size();i++){
           if(min > (int)list1.get(i)){
               min = (int)list1.get(i);
           }
       }
       System.out.println(\"Min number from list is \"+min);
   }
}

Hi please help with this JAVA LANGUAGE problem. Development assignment will call on you to implement a program from scratch. It’s an exercise in learning more a
Hi please help with this JAVA LANGUAGE problem. Development assignment will call on you to implement a program from scratch. It’s an exercise in learning more a
Hi please help with this JAVA LANGUAGE problem. Development assignment will call on you to implement a program from scratch. It’s an exercise in learning more a
Hi please help with this JAVA LANGUAGE problem. Development assignment will call on you to implement a program from scratch. It’s an exercise in learning more a

Get Help Now

Submit a Take Down Notice

Tutor
Tutor: Dr Jack
Most rated tutor on our site