6 Replies Latest reply: Dec 5, 2006 5:56 AM by 807607 RSS

    Array Assistance

    807607
      I have to write a program that requires me to declare and initializes a two dimensional array named "june" to the folllowing values:  The array #'s are {{3,4,7,34}; {37, 43, 0, 47}; {73, 74, 2, 3}; {6, 23, 26, 32}};  then use a nested "for" loop to calculate the average of all the numbers in the array then use a nested "for" loop to subtract the array average from each element of the array, use a nested "for" loop to square each element of the array then use a nested "for" loop to calculate the array average and then print the square root of the array average.  Please help me code this - I am struggling.
        • 1. Re: Array Assistance
          791266
          Do you expect people to read that post? Why did you post within code tags?
          • 2. Re: Array Assistance
            807607
            ho great research on Arrays
            • 3. Re: Array Assistance
              807607
              Do you expect people to read that post? Why did you
              post within code tags?
              atleast wrap ino 3 lines
              • 4. Re: Array Assistance
                807607
                Let's give a break to the newbie :-D
                I have to write a program that requires me to
                declare and initializes a two dimensional array named
                "june" to the folllowing values: The array #'s are
                {{3,4,7,34}; {37, 43, 0, 47}; {73, 74, 2, 3}; {6, 23,
                26, 32}}; then use a nested "for" loop to calculate
                the average of all the numbers in the array then use
                a nested "for" loop to subtract the array average
                from each element of the array, use a nested "for"
                loop to square each element of the array then use a
                nested "for" loop to calculate the array average and
                then print the square root of the array average.
                Please help me code this - I am struggling.
                • 5. Re: Array Assistance
                  807607
                  we r not here to do ur homework...
                  • 6. Re: Array Assistance
                    807607
                    public class HelpPoorRhel {
                         public static void main(String[] args) {
                              int june[][] = {{3,4,7,34},
                                        {37, 43, 0, 47},
                                        {73, 74, 2, 3},
                                        {6, 23, 26, 32}};
                              int avg;
                              avg = findAverage();
                              substractAverage();
                              squareElements();
                              avg = findAverage();
                              System.out.println("Blody hells");
                         }
                    
                         public static void squareElements() {
                              // TODO Auto-generated method stub
                              
                         }
                    
                         public static void substractAverage() {
                              // TODO Auto-generated method stub
                              
                         }
                    
                         public static int findAverage() {
                              // TODO Auto-generated method stub
                              return 0;
                         }
                    
                    }