Question

In: Computer Science

Suppose you have a set of data as shown below: {3, 25, 33, 21, 55, 43,...

Suppose you have a set of data as shown below:

{3, 25, 33, 21, 55, 43, 78, 31, 33, 75, 43, 11, 36, 4, 10, 99, A, B, C}

Write a Java class called "DataAnalysis" that has the following methods:

  • Data_NaN: this method filters nonnumerical data, for example, A, B, and C will be filtered out by this method;
  • Data_min: this method computes and returns the minimum of the numerical data;

Solutions

Expert Solution

Program:
  
import java.util.*;
  
public class DataAnalysis{


   static Set<String> Data_NaN(Set<String> set){
       Set<String> set2 = new HashSet<String>();
   for (String temp : set) {
       temp = temp.replaceAll(
       "[^0-9]", "");
         
       if(!(set.isEmpty())){
           set2.add(temp);
       }

   }
   return set2;
          
   }
public static void main(String args[])
{
// create empty set
Set<String> set = new HashSet<String>();
// {3, 25, 33, 21, 55, 43, 78, 31, 33, 75, 43, 11, 36, 4, 10, 99, A, B, C}
// add values one by one in set
set.add("03");
set.add("25");
set.add("33");
set.add("21");
set.add("55");
set.add("43");
set.add("78");
set.add("31");
set.add("33");
set.add("75");
set.add("43");
set.add("11");
set.add("36");
set.add("04");
set.add("10");
set.add("99");
set.add("A"); set.add("B"); set.add("C");
// print input set
System.out.println("Set: " + set);
// call funtion Data_NaN to filter out non-numerical data
System.out.println("After filtering nonnumerical data- Set: "+Data_NaN(set));
// call funtion Data_Min to calculate min value
System.out.println("Minimum number from set is= "+Data_Min(set));
  
}
   static String Data_Min(Set<String> set) {
       String obj = Collections.min(set);  
       return obj;
   }
}

Output:

Set: [78, A, B, C, 55, 04, 36, 33, 25, 11, 03, 21, 10, 43, 31, 99, 75]
After filtering nonnumerical data- Set: [, 78, 55, 04, 36, 33, 25, 11, 03, 21, 10, 43, 31, 99, 75]
Minimum number from set is= 03


Related Solutions

Suppose you have a set of data as shown below: {3, 25, 33, 21, 55, 43,...
Suppose you have a set of data as shown below: {3, 25, 33, 21, 55, 43, 78, 31, 33, 75, 43, 11, 36, 4, 10, 99, A, B, C} Write a Java class called "DataAnalysis" that has the following methods: Data_media: this method computes and returns the median of the numerical data; Data_mode: this method computes and returns the mode of the numerical data; Data_SortedArray: this method rearranges and returns the data in the increasing order (i.e., smallest to largest).
Suppose you have a set of data as shown below: {3, 25, 33, 21, 55, 43,...
Suppose you have a set of data as shown below: {3, 25, 33, 21, 55, 43, 78, 31, 33, 75, 43, 11, 36, 4, 10, 99, A, B, C} Write a Java class called "DataAnalysis" that has the following methods: Data_max: this method computes and returns the maximum of the numerical data; Data_average: this method computes and returns the average of the numerical data
Here is a set of sample data. 3 87 7 57 15 90 25 55 68...
Here is a set of sample data. 3 87 7 57 15 90 25 55 68 70 89 20 26 93 9 5 86 23 37 52 96 4 91 Base on the data above, identify the 5 number summary _ , _ ,_ , _ , _
Consider the following data. 21, 21, 37, 33, 38, 21, 37 (a) If you were to...
Consider the following data. 21, 21, 37, 33, 38, 21, 37 (a) If you were to construct a normal probability plot by hand for the above data what are the numerical values (in order) of the first five numbers that would go on the y-axis? Separate your answers with a comma. (use Z table)
For the data set shown below, complete parts (a) through (d) below. X 3 4 5...
For the data set shown below, complete parts (a) through (d) below. X 3 4 5 7 8 Y 3 5 8 12 13 (a) Find the estimates of Bo and B1. Bo=bo= _____ (Round to three decimal places as needed.) B1=b1= ______(Round to four decimal places as needed.) (b) Compute the standard error the point estimate for se= ____ (c) Assuming the residuals are normally distributed, determine Sb1=____ (Round to four decimal places as needed.) (d) Assuming the residuals...
For the data set shown below, complete parts (a) through (d) below. X 3 4 5...
For the data set shown below, complete parts (a) through (d) below. X 3 4 5 7 8 Y 4 7 6 12 15 (a) Find the estimates of Bo and B1. Bo=bo= _____ (Round to three decimal places as needed.) B1=b1= ______(Round to four decimal places as needed.) (b) Compute the standard error the point estimate for se= ____ (c) Assuming the residuals are normally distributed, determine Sb1=____ (Round to four decimal places as needed.) (d) Assuming the residuals...
the data set shown​ below, complete parts​ (a) through​ (d) below. x 3 4 5 7...
the data set shown​ below, complete parts​ (a) through​ (d) below. x 3 4 5 7 8 y 5 7 8 12 13 ​(a)  Find the estimates of beta 0 and beta 1. beta 0almost equalsb 0equals nothing ​(Round to three decimal places as​ needed.) beta 1almost equalsb 1equals nothing ​(Round to three decimal places as​ needed.)
the data set shown​ below, complete parts​ (a) through​ (d) below. x 3 4 5 7...
the data set shown​ below, complete parts​ (a) through​ (d) below. x 3 4 5 7 8 y 5 7 6 12 13 ​(a)  Find the estimates of beta 0 and beta 1. beta 0almost equalsb 0equals nothing ​(Round to three decimal places as​ needed.) beta 1almost equalsb 1equals nothing ​(Round to three decimal places as​ needed.)(a)  Find the estimates of beta 0 and beta 1. beta 0almost equalsb 0equals ??​(Round to three decimal places as​ needed.) beta 1almost equalsb...
Consider the following data: 43 54 55 63 67 68 69 77 85 Suppose that the...
Consider the following data: 43 54 55 63 67 68 69 77 85 Suppose that the last value is actually 115 instead of 85. What effect would this new maximum have on the median of the data? increase the value of the median decrease the value of the median no effect Approximately, what z-score divides the lower 75% of the data from the upper 25%? z = 0.75   z = 0.675   z = - 0.675   z = -0.25   none of...
Consider the following set of ordered pairs. x 33 11 55 44 y 44 33 44...
Consider the following set of ordered pairs. x 33 11 55 44 y 44 33 44 44 ​a) Calculate the slope and​ y-intercept for these data. ​b) Calculate the total sum of squares​ (SST). ​c) Partition the sum of squares into the SSR and SSE.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT