Skip to content

Commit 3db1a1a

Browse files
Add files via upload
1 parent ea38542 commit 3db1a1a

File tree

2 files changed

+44
-0
lines changed

2 files changed

+44
-0
lines changed

BoxPlot.java

+43
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
import java.lang.*;
2+
import java.util.*;
3+
import java.io.*;
4+
class BoxPlot
5+
{
6+
public static void main(String[] args) throws Exception
7+
{
8+
BufferedReader in = new BufferedReader(new FileReader("C://Users/it/Desktop/boxplot.txt"));
9+
10+
String inputLine = in.readLine();
11+
String [] fields = inputLine.split(" "); // Splits at the space
12+
int i=0;
13+
int [] arr=new int[fields.length];
14+
for(String str:fields){
15+
int x=Integer.parseInt(str); //prints out name
16+
arr[i++]=x;
17+
}
18+
System.out.println("---------The data set input from file-------");
19+
for(int a:arr)
20+
{
21+
System.out.print(a +" ");
22+
}
23+
System.out.println();
24+
System.out.println("-------------Five Point Summary(Box Plot)--------");
25+
Arrays.sort(arr);
26+
System.out.println("Sorted Data");
27+
for(int a:arr)
28+
{
29+
System.out.print(a+" ");
30+
}
31+
System.out.println();
32+
int n=arr.length;
33+
System.out.println("1.MAX VALUE--------->"+arr[n-1]);
34+
System.out.println("2.MIN VALUE--------->"+arr[0]);
35+
System.out.println("3.MEDIAN---------->"+arr[(n+1)/2-1]);
36+
System.out.println("4.QUARTILE 1--------->"+arr[(n+1)/4-1]);
37+
System.out.println("5.QUARTILE 3--------->"+arr[3*(n+1)/4-1]);
38+
39+
40+
41+
42+
}
43+
}

boxplot.txt

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
10 20 30 40 55 67 34 56 78 34

0 commit comments

Comments
 (0)