Commit 75e23879 authored by IT17165662's avatar IT17165662

Fixed Descriptive statistics calculation Mode function troubles

parent f082fa1b
......@@ -204,15 +204,18 @@ double firstQuartile;
modes.add(multimodes.getKey());
}
}
double[] datasetArray = new double[modes.size()];
for(int i=0;i<datasetArray.length;i++){
datasetArray[i] = modes.get(i);
}
for (double mode : modes){
System.out.println("ModesAnswer:"+modes);
list.add(0,invalue);
list.add(1,mode);
list.add(1,datasetArray);
list.add(2,a);
System.out.println("Mode value is " + mode);
System.out.println("Mode value is " + Arrays.toString(datasetArray));
......@@ -223,6 +226,7 @@ double firstQuartile;
/*int num_value = a.length;
int i, j, z, tmp = 0, maxCount;
double modeValue;
......
......@@ -7,6 +7,7 @@ import androidx.fragment.app.FragmentTransaction;
import android.content.Intent;
import android.os.Bundle;
import android.os.Parcelable;
import com.elearning.probabilityandstatisticsanalyserandeducator.R;
import com.elearning.probabilityandstatisticsanalyserandeducator.calculationfunction.StepsFragment.FirstQuartileFragment;
......@@ -19,6 +20,7 @@ import com.elearning.probabilityandstatisticsanalyserandeducator.calculationfunc
import com.elearning.probabilityandstatisticsanalyserandeducator.calculationfunction.StepsFragment.RangeFragment;
import com.elearning.probabilityandstatisticsanalyserandeducator.calculationfunction.StepsFragment.ThirdQuartileFragment;
import java.io.Serializable;
import java.util.ArrayList;
import java.util.Arrays;
......@@ -84,7 +86,9 @@ public class DescriptiveStatisticsCalcuation extends AppCompatActivity {
case "Mode":
bundle.putStringArray("Dataset_Values",(String[]) modelist.get(2));
bundle.putDouble("Mode_Value", (Double) modelist.get(1));
bundle.putDoubleArray("Mode_Value", (double[]) modelist.get(1));
// bundle.putParcelable("Mode_Value", (Parcelable) modelist.get(1));
// bundle.putSerializable("Mode_Value", (Serializable) modelist.get(1));
bundle.putIntArray("Ascending_order", (int[]) modelist.get(0));
ModeFragment modeFragment = new ModeFragment();
......
......@@ -48,11 +48,17 @@ public class ModeFragment extends Fragment {
String data = Arrays.toString(entereddataset);
String data2 = data.replace('[',' ' );
String data3 = data2.replace(']',' ');
Double mode = bundle.getDouble("Mode_Value");
double[] mode = bundle.getDoubleArray("Mode_Value");
//mode =bundle.getSerializable("Mode_Value");
String data7 = Arrays.toString(mode);
String data8 = data7.replace('[',' ' );
String data9 = data8.replace(']',' ');
mtextviewentereddata.setText(data3);
mtextviewmode.setText(mode.toString());
mtexviewfinalanswer.setText(mode.toString());
mtextviewmode.setText(data9);
mtexviewfinalanswer.setText(data9);
mtextviewascendingorder.setText(data6);
mtextviewascendingorder.setMovementMethod(new ScrollingMovementMethod());
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment