Results 1 to 7 of 7

Thread: Help Please !!!

  1. #1
    csprrung is offline Member
    Join Date
    Apr 2012
    Posts
    8
    Rep Power
    0

    Post Help Please !!!

    Write a program that takes 10 integers as input. The program will place these integers into an array and display the following:
    1. List in ascending order
    2. mean
    3. median
    4.max value
    5. minimum value
    Each operation should be calculated in a method

  2. #2
    JosAH's Avatar
    JosAH is offline Moderator
    Join Date
    Sep 2008
    Location
    Voorschoten, the Netherlands
    Posts
    13,519
    Blog Entries
    7
    Rep Power
    20

    Default Re: Help Please !!!

    We are not going to do your homework for you; you go first.

    kind regards,

    Jos
    cenosillicaphobia: the fear for an empty beer glass

  3. #3
    csprrung is offline Member
    Join Date
    Apr 2012
    Posts
    8
    Rep Power
    0

    Default Re: Help Please !!!

    my start

    Java Code:
    return 0;
        import java.util.*; 
        class nt
        { 
        public static void main(String args[]) 
        { 
        System.out.println("Enter the elements "); 
        Object sc;
    	char[][] a;
    	for(int i=0;i<10;i++) 
        int a[i]=((Object) sc).nextInt(); 
        System.out.println("you entered the array is"); 
        for(int i=0;i<10;i++) 
        System.out.println(a[i]); 
        System.out.println(" the reverse order array is"); 
        for(int i = 9;i>=0;i--) 
        System.out.println(a[i]); 
        } 
        }
    Last edited by JosAH; 04-17-2012 at 08:17 PM. Reason: added [code] ... [/code] tags

  4. #4
    JosAH's Avatar
    JosAH is offline Moderator
    Join Date
    Sep 2008
    Location
    Voorschoten, the Netherlands
    Posts
    13,519
    Blog Entries
    7
    Rep Power
    20

    Default Re: Help Please !!!

    Why are you printing your array backwards? It isn't part of your assignment. I take it that 'return 0;' at the start of your program is a copy/paste error but what does your compiler say about it?

    kind regards,

    Jos
    cenosillicaphobia: the fear for an empty beer glass

  5. #5
    shall is offline Senior Member
    Join Date
    Apr 2012
    Posts
    199
    Rep Power
    0

    Default Re: Help Please !!!

    Did you try to compile it? the return 0; at the top of the file will definitely give errors during compilation. Please debug it with a good IDE (i.e. Netbeans) and then state exactly what problems you are having.

  6. #6
    csprrung is offline Member
    Join Date
    Apr 2012
    Posts
    8
    Rep Power
    0

    Default Re: Help Please !!!

    I thought that it would be better to do it that way i dont understand how to sart the methods

  7. #7
    JosAH's Avatar
    JosAH is offline Moderator
    Join Date
    Sep 2008
    Location
    Voorschoten, the Netherlands
    Posts
    13,519
    Blog Entries
    7
    Rep Power
    20

    Default Re: Help Please !!!

    This isn't going anywhere; I setup your class structure:

    Java Code:
    public class YourClass {
    
       private static int[] readArray() { ... }
    
       private static void sortAscending(int[] array) { ... }
    
       private static void mean(int[] array) { ... }
    
       private static void median(int[] array) { ... }
    
       private static void minimum(int[] array) { ... }
    
       private static void maximum(int[] array) { ... }
    
       public static void main(String[] args) {
          int[] array= readArray();
    
          sortAscendig(array);
          mean(array);
          median(array);
          minimum(array);
          maximum(array);
       }
    }
    You fill in the dots.

    kind regards,

    Jos
    cenosillicaphobia: the fear for an empty beer glass

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •