Results 1 to 4 of 4
  1. #1
    I-Shine is offline Member
    Join Date
    Dec 2007
    Posts
    2
    Rep Power
    0

    Default The highest number

    The application is meant to ask for 10 numbers and print out the highest, here is what I have been able to do:

    Java Code:
    import java.io.*;
    public class ArrayExample 
    {
       static BufferedReader kbRead = new BufferedReader(new InputStreamReader(System.in));
       public static void main(String[] args) throws IOException 
       {
          int numNames = getInt("Number of names? ");
          String[] names = new String[numNames];
          for (int i = 0; i < names.length; i++) 
          {
             names[i] = getString("Enter name #" + i);
          }
          for (int i = 0; i < names.length; ++i) 
          {
             System.out.println(names[i]);
          }
       }
    
       public static int getInt(String prompt) throws IOException 
       {
          System.out.print(prompt + " ");
          return Integer.parseInt(kbRead.readLine());
       }
       public static String getString(String prompt) throws IOException 
       {
          System.out.print(prompt + "The highest number is" + numNames);
          return kbRead.readLine();
       }
    }

  2. #2
    gulapala is offline Member
    Join Date
    Dec 2007
    Posts
    11
    Rep Power
    0

    Default

    so what do you want?
    Whare are you expecting?
    what is your result?
    Thanks & Regards, G.Rajasekhar

  3. #3
    I-Shine is offline Member
    Join Date
    Dec 2007
    Posts
    2
    Rep Power
    0

    Default

    Quote Originally Posted by gulapala View Post
    so what do you want?
    Whare are you expecting?
    what is your result?
    I am trying to get the highest number between 1 - 10

  4. #4
    winniejr_99 is offline Member
    Join Date
    Feb 2008
    Posts
    6
    Rep Power
    0

    Default

    hello.. do you have the method for getting the highest number already?

Similar Threads

  1. line number
    By kazitula in forum New To Java
    Replies: 3
    Last Post: 11-21-2007, 10:27 PM
  2. Replies: 3
    Last Post: 11-18-2007, 07:41 PM
  3. how to know the number of bytes
    By gabriel in forum New To Java
    Replies: 2
    Last Post: 08-06-2007, 05:13 PM
  4. how to know the number of the line
    By simon in forum New To Java
    Replies: 3
    Last Post: 08-01-2007, 04:59 PM
  5. Help with setting number as even or odd
    By fegiflu in forum New To Java
    Replies: 8
    Last Post: 07-24-2007, 06:07 PM

Posting Permissions

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