constructors and command lines

I would like to know how you allow command line input for a constructor created object.

For example, my patient class has a constructor that will create a patient with 5 parameters id, name, age, etc.....

public Patient(int d, String n, int a, int s, int x) {

id = d;

age = a;

tl = s;

name = n;

timearv = x;

In my Clinic class I would like to allow a user to be able to enter details on the command line to create a patient......DON'T KNOW HOW!!!

below is what i've come up with, but of course it doesnt work.....any help would be appreciated.....

Clinic c = new Clinic();

System.out.println("Add patient details");

Patient x = new Patient(id, name, age, tl,timearv);

[750 byte] By [malslaa] at [2007-10-2 10:53:27]
# 1

Normally you present the user with a form consisting of fields the user fills in. When the user is finished and presses an OK button you read the filled-in fields and convert them to the internal types you expect/need. This information is then used to create objects.

You can read about this in the Swing tutorial.

A simpler way is to read from the standard input like this,

http://javaalmanac.com/egs/java.io/ReadFromStdIn.html

You can convert the read Strings to numbers like this,

http://javaalmanac.com/egs/java.lang/ConvertNum.html

malslaa at 2007-7-13 3:16:17 > top of Java-index,Java Essentials,New To Java...