It's not a secret anymore!
The moose likes Beginning Java and the fly likes Java Class Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Java Class" Watch "Java Class" New topic

Java Class

stab cooper

Joined: Feb 07, 2006
Posts: 6
I have a task which I have to do and I need your help. I need to know the code.

The Patient class must store the following information about a patient: the patient's reference number as an int, the patient's name as a String, their age as an int , the patient's date of birth as a Date. In addition, the class also stores the patient's arrival time and the time they started their treatment, both of type Time.

Write a constructor which sets the patient's reference number, name, age and date of birth from suitable formal parameters. The date of birth should be represented by three formal parameters of type int which are then passed on as actual parameters to a Date constructor. The time when the patient arrived and the time when they start their treatment should be set to null.
pascal betz
Ranch Hand

Joined: Jun 19, 2001
Posts: 547
and what is your question ? do you want us to write the full code for you ?
this is a how a minimal class might look like:

then you have to add a constructor. a constructor is a "special method" that has the same name as your class and no return type.

they can have a list of arguments:

and so on....


[ February 07, 2006: Message edited by: pascal betz ]
[ February 07, 2006: Message edited by: pascal betz ]
luc comeau
Ranch Hand

Joined: Jan 20, 2005
Posts: 97
Stab, if that is your real name...One thing you must realize that this is a forum to guide people in the right direction, not do their homework assignments.If you are in a java class at school, try reading some of the notes, im sure your instructor didn't assign you to write a program unless they taught you how. But, one tip i can give is that in assignment questions they often describe what "instance variables" are needed in the description of the problem itself, and are usually the nouns.These instance variables usually have private acess within a class, and are used to describe "features" of that class.
Anyways here are some links that could help you get started, but other then that you can always seacrh on google, im sure there are 1000000's of begginners java tutorials!good luck!
If you have any specific question im sure myself or anyone else will try to answer it for you.
tutorial 1
Tutorial 2
[ February 07, 2006: Message edited by: luc comeau ]

National Research Council<br />Internet Logic Department
I agree. Here's the link:
subject: Java Class
It's not a secret anymore!