• Post Reply Bookmark Topic Watch Topic
  • New Topic

What am I missing?  RSS feed

 
J Jacks
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
OK...I am a complete noob at Java and while I like it...I think there are a few things I am missing. For my assignment I need to write a program that compares the numbers entered and determines the median number here is what I have so far:



I tried adding another method at the bottom of the program that would find the median and display it along with the sorted numbers.....and it obviously won't work (I commented it out) I want to add it in where the someNumbs and calculations are...but I am not sure how to go about doing this. I am happy with most of the program so far. (It was from my book) but I guess I am too new at this to figure out the best way to add the median calculations without breaking it. I would like to hear your suggestions and what you think is the best way to do this.

Thanks
J
 
Viktor Kubinec
Ranch Hand
Posts: 34
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Every method needs of be inside of a class, this one is not... Also if you want to acces your method directly from main method it has to be also static method (public static int findMedian... )

check your brackets ...{....}
 
J Jacks
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks Victor...that cleared up all the errors. I guess now I need to streamline it so it will display the median in the dialog window. Thanks for helping me with that.
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!