plxxxxxxxxxxx help me thts ma java assg for mean median and mode i have calculated some part of it for group data can any 1 help me to find out the rest offfffffff

String ans;
int total=0,small=0,large=0;
int numEntries=0;
float range=0.0f;
float wid = 0;

// user enters number
String message="";
do{
ans = JOptionPane.showInputDialog(null, "Enter a number between 1 and 1000");
if(ans==null || ans.trim().equals("")){
continue;
}
if("0".equals(ans)){
break;
}
int input = Integer.parseInt(ans);
if(input>=1 && input <=1000){
total = total + input;
if(input<small || numEntries==0){
small=input;
}
if(input>large || numEntries==0){
large=input;
}
numEntries++;
range = large - small;
}else{
message = "Enter number between 1 and 1000 only";
JOptionPane.showMessageDialog(null, message);
}
}while(true);
message = "The total is " + total + "\n";
message = message + "The range is " + range + "\n";
message = message + "The largest value is " + large + "\n";
message = message + "The smallest value is " + small + "\n";


JOptionPane.showMessageDialog(null, message);
String cls = JOptionPane.showInputDialog("Please enter No.of Classes");
int clas=Integer.parseInt(cls);
wid=range/clas;
JOptionPane.showMessageDialog(null, "the Width is:" + wid);
float a = small+wid;
float b = a+wid;
float c = b+wid;
float d = c+wid;
float e = d+wid;

String h=JOptionPane.showInputDialog("Enter class boundry value:");
Float cb = new Float(h);
float a1 = small-cb;
float a11= a+cb;
float b1 = b+cb;
float c1 = c+cb;
float d1 = d+cb;
float e1 = e+cb;
float e11=e1+cb;
float h1 =(small+a)/2;
float h2 =(a+b)/2;
float h3 =(b+c)/2;
float h4 =(c+d)/2;
float h5 =(d+e)/2;
JOptionPane.showMessageDialog(null,"the cb is:" + cb);
JOptionPane.showMessageDialog(null,"CLASSES"+"\t"+"||"+"CLASS BOUNDRY"+"||"+"X"+"\n"+"class A:"+"\t"+small+"--"+ a+ "||"
        +a1+"---"+a11+"||"+h1 +"\n"+ "Class B:"+"\t"+a+"--"+ b+ "||"+a11+"---"+b1+"||"+h2+"\n"+
        "Class C:"+"\t" +b+"--"+c+ "||"+b1+"---"+c1+"||"+h3+"\n"+ "Class D:"+"\t"
        +c+"--"+d+ "||" +d1+"---"+e1 +"||"+h4+"\n"+"Class E:"+"\t" +d+"--"+e+ "||" +e1+"---"+e11+"||"+h5);

Edited 6 Years Ago by peter_budo: Keep It Organized - No code tags, generic thread title

Comments
no help for babies
Rubbish title, lame kiddie speak and NO CODE TAGS -> ignore^3

No one understands what you say. Use proper English and code tags. Press the code button when you make a new post and put your code inside. It makes your code easier to read.

Also please don't do this: "plxxxxxxxxxxx" It is against the forum rules and annoying.

Edited 3 Years Ago by mike_2000_17: Fixed formatting

Comments
*nods*

what do you mean by proper english by the way????
am I not using the right one....................!!!!!!!
I was in hurry so i wrote in a shorter way ... well buddy
Its none of my problem if you can't understand the short
languages:twisted::cool:
Well i have an assignment of java coding for median, mean and mode for grouped data and i have coded some part of it to some extend
but i dont know how to find the mode in java using the coding i have enclosed so it would be so kind of anyone who can let me know how to do this............?
i must say now you have well understood:yawn:

Comments
You were in a hurry? And that's why you write poor English? To save time? Well, it won't save any time, the so-called experts will need more time to figure out what you're asking.
Sorry, boredom set in during your rant

Sorry guys i was in hurry last day so i post in poor language but now i confess it and writing down the details so that you may reply my post.
i have an assignment of java programming to implement all of the statistics formulas so i am working on that project i have done median and mean for both grouped and ungrouped data but i don't know how to find the mode so help me guys

String ans;
int total=0,small=0,large=0;
int numEntries=0;
float range=0.0f;
float wid = 0;

// user enters number
String message="";
do{
ans = JOptionPane.showInputDialog(null, "Enter a number between 1 and 1000");
if(ans==null || ans.trim().equals("")){
continue;
}
if("0".equals(ans)){
break;
}
int input = Integer.parseInt(ans);
if(input>=1 && input <=1000){
total = total + input;
if(input<small || numEntries==0){
small=input;
}
if(input>large || numEntries==0){
large=input;
}
numEntries++;
range = large - small;
}else{
message = "Enter number between 1 and 1000 only";
JOptionPane.showMessageDialog(null, message);
}
}while(true);
message = "The total is " + total + "\n";
message = message + "The range is " + range + "\n";
message = message + "The largest value is " + large + "\n";
message = message + "The smallest value is " + small + "\n";


JOptionPane.showMessageDialog(null, message);
String cls = JOptionPane.showInputDialog("Please enter No.of Classes");
int clas=Integer.parseInt(cls);
wid=range/clas;
JOptionPane.showMessageDialog(null, "the Width is:" + wid);
float a = small+wid;
float b = a+wid;
float c = b+wid;
float d = c+wid;
float e = d+wid;

String h=JOptionPane.showInputDialog("Enter class boundry value:");
Float cb = new Float(h);
float a1 = small-cb;
float a11= a+cb;
float b1 = b+cb;
float c1 = c+cb;
float d1 = d+cb;
float e1 = e+cb;
float e11=e1+cb;
float h1 =(small+a)/2;
float h2 =(a+b)/2;
float h3 =(b+c)/2;
float h4 =(c+d)/2;
float h5 =(d+e)/2;
JOptionPane.showMessageDialog(null,"the cb is:" + cb);
JOptionPane.showMessageDialog(null,"CLASSES"+"\t"+"||"+"CLASS BOUNDRY"+"||"+"X"+"\n"+"class A:"+"\t"+small+"--"+ a+ "||"
        +a1+"---"+a11+"||"+h1 +"\n"+ "Class B:"+"\t"+a+"--"+ b+ "||"+a11+"---"+b1+"||"+h2+"\n"+
        "Class C:"+"\t" +b+"--"+c+ "||"+b1+"---"+c1+"||"+h3+"\n"+ "Class D:"+"\t"
        +c+"--"+d+ "||" +d1+"---"+e1 +"||"+h4+"\n"+"Class E:"+"\t" +d+"--"+e+ "||" +e1+"---"+e11+"||"+h5);

Can you explain what the 'mode' is. Out 'Math' is a bit rusty.

And from what I see the code you posted seems to be OK. Are you having any specific problems with that code?

To find the mode you have to find the number that has been repeated the most in a sequence. You could use a loop to check this.

To find the mode you have to find the number that has been repeated the most in a sequence. You could use a loop to check this.

If that is true about the mode then since you have this rule:
if(input>=1 && input <=1000)
You can do this:

int [] array = new int[1000];

The input given would be the index of that array, and whenever you enter a number increase the index:

int [] array = new int[1000];
if(input>=1 && input <=1000){
   total = total + input;
   array[input-1] = array[input-1] + 1;
}

For example if you enter '3' 5 times then the: array[[B]2[/B]] would have value 5. Then find where the max of that array is the index would be the number with the most occurrences:
[0]: 1
[1]: 2
[2]: 6
[3]: 3
[4]: 5

Number 3 was entered 6 times.
Find the max number which is 6, that would mean that the index 2 was given 6 times.

Edited 6 Years Ago by javaAddict: n/a

what do you mean by proper english by the way????
am I not using the right one....................!!!!!!!

If you don't know, go back to kindergarten.

I was in hurry so i wrote in a shorter way ... well buddy

tough luck.

Its none of my problem if you can't understand the short
languages:twisted::cool:

yes, it is. We CHOOSE not to understand your idiot ramblings, even if maybe we do.
We do so because they show you to be an immature kid who's unwilling or incapable of communicating like a normal human being.
We want to have nothing to do with such kids.

Well i have an assignment of java coding for median, mean and mode for grouped data and i have coded some part of it to some extend
but i dont know how to find the mode in java using the coding i have enclosed so it would be so kind of anyone who can let me know how to do this............?
i must say now you have well understood:yawn:

Again, tough luck. You've made yourself impossible, no help for you.

I find it interesting that the posts that were marked +rep and helpful were ones that didn't have anything to do with the topic but rather blasted the OP. I agree with some of the remarks that were made about the improper english. That type of typing/use of language is more of a hassle than its worth to help the OP out for. But I don't think those posts should be marked as helpful.

The helpful posts came from javaAddict and Kontained (i went ahead and marked them as helpful).

@hina hasan
The more effort and respect you show to the members that you are asking for help, the more help they are willing to offer ;)

This article has been dead for over six months. Start a new discussion instead.