Results 1 to 4 of 4

Thread: yet another how do i ?

  1. #1
    Join Date
    Feb 2009
    Posts
    96

    yet another how do i ?

    i need to make a method that receives an array and an average
    i need to get the elements in the array that are higher then the average.

    now i have a method called aveArray which gives me an average that is called by my main.

    my question is how do i make the method called highPrices call on the aveArray method and how do i set it up so that all the higher then average prices display in a dialog box?

    sorry about these questions my book really sucks

  2. #2
    Join Date
    Oct 2005
    Posts
    2,393

    Re: yet another how do i ?

    public class ArrayAverage{
    public static void main(String[] args) {
    double nums[]={1.0,2.3,3.4,4.5,40.5};
    double result=0.0;
    int i=0;
    for(i=0; i < nums.length; i++){
    result=result + nums[i];
    }
    System.out.println("Average is =" + result/nums.length);
    }
    }

  3. #3
    Join Date
    Dec 2008
    Posts
    183

    Re: yet another how do i ?

    Hello Daren,

    Though you have mentioned your requirements but you have forget to mentioned in which Programming language you need your Output, because we could expect average with array using JAVA, C# and also with the Excel, so please mention the programming language.

    Regards

  4. #4
    Join Date
    Feb 2009
    Posts
    96

    Re: yet another how do i ?

    needs to be in JAVA

    the array is populated by input boxes and is in another method
    i have 4 methods all together

    input for the array
    sumArray()
    avgArray()
    highPrices() <---- i need this one
    everytime i do it it says it cant accept more then one type or something like that

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Page generated in 1,714,046,521.44043 seconds with 16 queries