Results 1 to 4 of 4
Thread: The highest number
- 12-13-2007, 11:46 AM #1
Member
- Join Date
- Dec 2007
- Posts
- 2
- Rep Power
- 0
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(); } }
- 12-13-2007, 12:29 PM #2
Member
- Join Date
- Dec 2007
- Posts
- 11
- Rep Power
- 0
so what do you want?
Whare are you expecting?
what is your result?Thanks & Regards, G.Rajasekhar
- 12-13-2007, 01:41 PM #3
Member
- Join Date
- Dec 2007
- Posts
- 2
- Rep Power
- 0
- 02-13-2008, 05:05 AM #4
Member
- Join Date
- Feb 2008
- Posts
- 6
- Rep Power
- 0
Similar Threads
-
line number
By kazitula in forum New To JavaReplies: 3Last Post: 11-21-2007, 10:27 PM -
How to get next available number from MS access
By shahjehan in forum JDBCReplies: 3Last Post: 11-18-2007, 07:41 PM -
how to know the number of bytes
By gabriel in forum New To JavaReplies: 2Last Post: 08-06-2007, 05:13 PM -
how to know the number of the line
By simon in forum New To JavaReplies: 3Last Post: 08-01-2007, 04:59 PM -
Help with setting number as even or odd
By fegiflu in forum New To JavaReplies: 8Last Post: 07-24-2007, 06:07 PM


LinkBack URL
About LinkBacks
Reply With Quote

Bookmarks