Help Me With Classes Please...

ok i just starting programming in java about 4 weeks ago and i am a real novice so i could use a lot of help on this little problm.
anyway its basically a system to keep information for a hospital about their patients. there is a class and a sub-class. Patients is main class with attributes like ID, Name, Phone. Observations is a sub-class of Patients and has a sub-class of its own called Measurement-Observations with attributes like height and weight. (basically this: patients -> observations -> measurements) with the attributes slotted in there too of course.
so i was wondering how some of u experts would go about firstly declaring the class and sub-class and then go about adding a patients information into both classes when done.
any help is greatly appreciated, thanx

Let Patients be the main class
public abstract class Patients
   public abstract void setID(int ID);
   public abstract int getID();
   public abstract void setName(String name);
   public abstract String getName();
   public abstract void setPhoneNumber(String phone);
   public abstract String getPhoneNumber(); 
//Observations inherits from Patients
public class Observations extends Patients
   //declare variables
   private int ID;
   private String name;
   private String phoneNumber;
   //Constructor
   public Observations(int ID, String name, String phoneNumber)
       this.ID = ID;
       this.name = name;
       this.phoneNumber= phoneNumber;
   public void setID(int ID)
       this.ID = ID;
   public int getID()
      return ID;
   public void setName(String name)
      this.name = name;
   public String getName()
       return name;
   public void setPhoneNumber(String phoneNumber)
      this.phoneNumber = phoneNumber;
   public String getPhoneNumber()
      return phoneNumber;
}And your Measurement-Observations class inherits from Observations
public class Measurement-Observations extends Observations
   private int ID;
   private String name;
   private String phoneNumber;
   private double height;
   private double weight;
   public Measurement-Observations(int ID, String name, String phoneNumber, double height, double weight)
       super();
       this.height = height;
       this.weight = weight;
   public void setHeight(double height)
      this.height = height;
   public double getHeight()
      return height;
   public void setWeight(double weight)
      this.weight = weight;
   public double getweight()
      return weight;
}How to use this in an application?
This is an example..a simpel one :)
import java.util.*;
public class MyPatients
   private Vector patientinfo;
   public static void main(String[] args)
       new MyPatients();
   public MyPatients
       patientinfo = new Vector();
       //to add info about a patient
       patientinfo.addElement(new Measurement-Observations(1, "John Smith",
"086-5768", 6.2D, 160);

Similar Messages

  • HT5622 i need help using the icloud it is not making any since to me can some one call me and help me with it please don't try to help me through email i need to talk and listen i don't understand instruction by reading

    i need help using the icloud it is not making any since to me can some one call me and help me with it please don't try to help me through email i need to talk and listen i don't understand instruction by reading.
    <Phone Number Edited by Host>

    You aren't addressing anyone from Apple here.  This is a user forum.
    You might want to call a neaby Apple store to see if they have a free class you could attend.

  • TS3276 I am not able to Mobile Me email account to connect with iCloud or my Apple Mail program. Don't know if my settings are correct or not. Can anyone help me with this please?

    I am not able to Mobile Me email account to connect with iCloud or my Apple Mail program. Don't know if my settings are correct or not. Can anyone help me with this please?

    http://support.apple.com/kb/HT5922
    If you want to mirror your desktop, see:
    http://support.apple.com/kb/HT5404
    Regards.

  • I have a brand new MacBookProo and I can not open PDF files from my desktop. Can anyone help me with this please?

    I have a brand new MacBookProo and I can not open PDF files from my desktop. Can anyone help me with this please?

    A new Mac comes with 90 days of free tech support from AppleCare.
    AppleCare: 1-800-275-2273

  • Can anyone help me with forms please

    -----------------------------------source.cfm--------------------------------------------
    <cfquery name="myquery" datasaource="mydatasource">
    select studentid
    from tbl_student
    </cfquery>
    <cfform action="reciever.cfm" method="post">
    <cfoutput query="myquery">
    <cfinput name="#myquery.studentid#" type="text">
    </cfoutput>
    </cfform>
    ------------------------------------reciever.cfm------------------------------------------ ----
    <cfquery name="myquery2" datasource="mydatasource">
    select studentid,studentname
    from tbl_student
    </cfquery>
    <cfoutput query="myquery2">
    <cfif #form.#myquery2.studentid## eq
    #myquery2.studentname#>
    Student Found
    </cfif>
    </cfoutput>
    anyone can know how to do this? i just want to make the
    #form.# dynamic because the id is coming from database
    but seems it is not allowed... anyone can help me with this
    please?or anyone know alternative solution for it?thanks in
    advance.

    thanks again cf_dev2...
    but the <cfinput> that i'm trying to use was dynamic
    because it can be a textbox or a radio button or a checkbox.. i got
    no problem in assigning their name now.. because i string
    concatinated them like placing their specific id from the database
    into their name,for example
    <cfquery name="choices" datasource="mydatasource">
    select choiceid,choicetype
    from tbl_choice
    </cfquery>
    <cfform name="source.cfm" method="post">
    <cfoutput query="choices">
    <cfset choicename='multiplechoice'>
    <cfset choicenamed = choicename.concat(#choiceid#)>
    <cfif #choices.choicetype# eq 'multiplechoice'>
    <cfinput type="radiobutton" name="#choicenamed#">
    </cfif>
    </cfoutput>
    </cfform>
    the problem now is the way how can i receive it and compare
    it on the answer values from the database for the choices.

  • Help me with JARs PLEASE!!!!

    Hello,
    Following is the scenario
    Application name: PL
    Directory "PL" has
    - A.jar
    - B.jar
    When I create PL.jar I store it in the dir "PL" by using the appropriate relative path to A.jar and B.jar in the manifest file. PL.jar executes in folder "PL"; BUT when I copy PL.jar to another folder say desktop it gives me a NoClassDefFoundError. Can anybody help me with this as I have wrecjed my brains over this for 2 days. I have to distribute PL.jar to clients for testing purpose.....Please reply ASAP.
    Thanks.
    Salil.

    set (class) path or use package if its inside your dir.
    Message was edited by:
    deAppel

  • Suddenly my music videos won't play on my iPad. I just get the audio? Can anyone help me with this please?

    SUddenly my music videos won't play on my ipad1. I just get the audio. Can anyone help with this please?

    Look in the Videos App and play them in there.

  • Hi, my name is Chenet i have a Macbook 0sx lion 10.7.5 i don't remember my password for the system preferences i can't even go online, can somebody help me with that please

    Hi, my name is Chenet i have a Macbook 0sx lion 10.7.5 i don't remember my password for the system preferences i can't even go online, can somebody help me with that please

    Hi 'baltwo'
    Thank you for your link, I already had been on this particular website this afternoon. they only discuss problems in the application and nothing about how the MS Office application installation does disturb Mac OS.
    Or have I missed a special comment there?
    In any case many thanks, trioloGo

  • Help me with net, please!!!

    I'm a beginner
    I have to learn java urgently... as fast as possible.
    So I need a little net. application which works with strings, url and have graphic interface?
    For example: a window with button, which on pushing get some information from one of the url and do something with this information. It doesn't matter...
    Have you smth for me???
    Please!!!

    public class TeachmeJava{
    boolean lazy = true;
    String solution="Study!!!!!";
    public static void main (String args){
    TeachmeJava j = new TeachmeJava();
    if (j.lazy){
    System.out,println(solution);
    Does this help? ;)
    Sorry for the typo. Too many custom tags lately :)

  • Could someone help me with class Process getErrorStream() ??

    Hello
    I want to execute process "/usr/bin/octave" .So I have to write to its input and read its output and error stream. I have written program and it works good until I need to read error stream of process. After I read the error stream of process i receive the IOException Broken pipe. It looks like after read the data from error stream process is closed so I coudn't write anything to the input stream (what i could do before reading from error stream). The errors I receive :
    java.io.IOException: Broken pipe
    at java.io.FileOutputStream.writeBytes(Native Method)
    at java.io.FileOutputStream.write(Unknown Source)
    at java.io.BufferedOutputStream.flushBuffer(Unknown Source)
    at java.io.BufferedOutputStream.flush(Unknown Source)
    at sun.nio.cs.StreamEncoder$CharsetSE.implFlush(Unknown Source)
    at sun.nio.cs.StreamEncoder.flush(Unknown Source)
    at java.io.OutputStreamWriter.flush(Unknown Source)
    at java.io.BufferedWriter.flush(Unknown Source)
    at wazna$3.run(octave.java:116)
    at java.lang.Thread.run(Unknown Source)
    And here is my code:
    import java.io.BufferedReader;
    import java.io.BufferedWriter;
    import java.io.IOException;
    import java.io.InputStream;
    import java.io.InputStreamReader;
    import java.io.OutputStream;
    import java.io.OutputStreamWriter;
    public class octave{
    public static void main(String[] args) throws IOException, InterruptedException {
    Runtime r = Runtime.getRuntime();
    final Process p= r.exec("/usr/bin/octave");
    System.out.print(">>");
    InputStream iss = p.getInputStream();
    BufferedReader br =
    new BufferedReader(new InputStreamReader(iss));
    try {
    while (iss.available() == 0) { }
    while (br.ready())
    System.out.println(br.readLine());
    } catch (IOException e) { e.printStackTrace();}
    String s=null;
    do
    System.out.print(">>");
    BufferedReader in = new BufferedReader(new
    InputStreamReader(System.in));
    s = in.readLine();
    if (s.equalsIgnoreCase("exit"))
    System.out.print(">>");
    System.out.print("END");
    else
    Thread reading = new Thread(
    new Runnable()
    synchronized public void run()
    InputStream iss = p.getInputStream();
    BufferedReader br =
    new BufferedReader(new InputStreamReader(iss));
    try {
    while (iss.available() == 0) { }
    while (br.ready()) {
    System.out.println(br.readLine());
    } catch (Exception e) {e.printStackTrace();                                                                                                                                } }
    Thread error = new Thread(
    new Runnable()
    synchronized public void run()
    InputStream err=p.getErrorStream();
    BufferedReader er =
    new BufferedReader(new InputStreamReader(err));
    try {
    while (err.available() == 0) {
    while (er.ready()) {
    System.err.println(er.readLine());
    } catch (Exception e) {
    // TODO Auto-generated catch block
    e.printStackTrace();
    final String g=s;
    Thread writing = new Thread(
    new Runnable()
    synchronized public void run()
    OutputStream oos = p.getOutputStream();
    BufferedWriter bw =
    new BufferedWriter(new OutputStreamWriter(oos));
    try {
    bw.flush();
    bw.write(g);
    bw.newLine();
    bw.flush(); //LINE 116 where is an error
    } catch (Exception e) {
    // TODO Auto-generated catch block
    e.printStackTrace();
    writing.start();
    reading.start();
    error.start();
    while (!s.equalsIgnoreCase("exit"));
    Message was edited by:
    tazja
    Message was edited by:
    tazja

    I know it's a bit late for this. But I hope it will help all the people who encountered this problem.
    The only way to let octave work with streams is to use the --interactive switch (otherwise it will crash on the first error). Rembember that using this will need a different way to read data (BufferedReader won't work well).
    Hope this helps anyone, I spent very much time figuring this.
    Bye

  • Help needed with JDBC - please help! (newbie)

    hi all
    i m new to jdbc
    i have installed MySQL server on my winxp machine
    i used the command:
    mysql -p -u root
    Enter password: ****now when writing a prog i m getting a prob at this piece of code:
    Connection con=DriverManager.getConnection("jdbc:odbc:books","root","root");wot is wrong wid this code?
    please help......
    thanks in advance

    There are about 20 different things that could be wrong a this point; I'm not going to list them all. If you want specific help, you need to post specific information. This is usually done by posting either a stack trace from an exception, or a more complete section of code and a description of the problem and ALL the symptoms. You have all the information on what you've done, we have none of it.
    Instead of trying to diagnose whats wrong with your ODBC setup, I'm going to give you some strong advice; don't use ODBC with JDBC if you can avoid it, and with MySQL you can avoid it. It makes things simpler, less can go wrong, and you don't have to configure a DSN on every machine that you install the program on.
    To use "pure" JDBC without ODBC for MySQl:
    1) download the JDBC driver (you might already have this)
    http://dev.mysql.com/downloads/connector/j/3.1.html
    2) follow the installation instructions
    http://dev.mysql.com/doc/refman/5.0/en/java-connector.html
    In particular, make sure your classpath is set correctly
    3) Here's an example of loading the driver and establishing a connection
    http://dev.mysql.com/doc/refman/5.0/en/cj-connect-with-drivermanager.html
    Note the form of the connection URL,
    "jdbc:mysql://localhost/test?user=monty&password=greatsqldb"
    This is what an URL without ODBC looks like; there is no DSN, which means no DSN has to be configured.
    4) The MySQL database has some built-in security, to prevent malicious connections from outside computers. Solutions to that and other common problems are here:
    http://dev.mysql.com/doc/refman/5.0/en/cj-faq.html

  • Help working with sockets, please

    hi
    i've managed to do some applications similar to chat programs, and i would like to know if my design is... acceptable
    my problem used to be that any function trying to read data from a socket would block until it gets some data. if my applicacion is like a chat, i don't know when data is arriving.
    so my solution is:
    create a thread, which would be always reading the input stream from the socket. whenever it gets data, it send an event which listened by the main class, say, a JFrame.
    so i created my own events, listener and listenermulticaster. well it works great but i wonder if there is another simpler way to do it.
    another think that bothers me:
    when i have my thread with my connected socket, and i want to shut the appz down, the only way i've found is to close the socket. the thread must be able to manage that, and afterwards, returns from run function.
    well what do u think about all of this?? i would be very grateful for any opinion you tell me
    thanks in advance

    a reference to the thread, calls that method. the
    socket is closed, the main loop breaks (i dont
    remember now if an exception is thrown) and the thread
    ends
    i agree, i dont like this and it seems unreliable.
    about the method interrupt, what is the diference from
    retunrning from run method??
    thanks very much for your help!!you will have a method that is reading from the Socket, it will block until some data is available
    closing the Socket (one would hope) should cause that method to throw an Exception, you can use that Exception to exit the run() method, but if the Socket is closed from the other end, then it seems unreliable that the Exception is thrown, leavin the read method waiting for data that it can never recive
    Thread.interrupt() will terminate all such blocking IO methods and you can use this also to exit the run() method
    belt and braces maybe, but handy all the same

  • System now workin :) help/advice with XP please if you can

    finally got my new system to post so looking good sp far...... started installing win xp and had an error message - disc might be a dodge one!! then thought 'o sod it, i think i'll use win 2000 anyway as seems to have less probs than xp at the mo'
    the problem is, as the install didnt complete, each time i put my win2000 cd in the drive it tries to finish the xp installation. i cant seem to get it to boot from the win2000 disc.
    how do i stop win xp doing this?? can you 'back-it-out' some how or shouldnt it do this and the win2000 should 'take-over'
    bit confused on what to do.
    hope someone can help.
    thanx

    Hi
    Your first problem with XP not completing does sound like a bad disc or your rom drive. Can you borrow another CD or Rom Dive. Can you make a copy of your XP CD on another machine and try the copy.
    Whether you stick with XP or go to Win2000 I suggest you delete partion, reformat and start again. If you are a games player do not move over to Win2000.
    Best of Luck. Russ Pyne

  • Help compiling with .class files

    I am using JGrasp and I am trying to compile a program that uses .class files instead of the .java files, but JGrasp will not recognize these at compile time. How do I get my program to compile with these .class files?

    I prefer using Jenuity:
    [http://www.nmmu.ac.za/jenuityIDE]
    It's much simpler to use than JGrasp and isn't nearly as confusing.
    For the record, you compile .java files into .class files. There is no need to "compile" existing .class files. If you have the class files you can run them from the command line. e.g. if you have a class file named Orange.class you should be able to type "java Orange" from the command line to run it. If Orange is inside a directory structure based on packages you may need to execute this command from just outside the 'highest" folder.
    If you just need to link to these class files, copy them into the "/jre/lib/ext" folder of your JDK.

  • Help me with database please

    I need to connect to a database file source (namely a .CSV file) which is a simple semi-colon delimmited text file. I only know how to configure the data source through 'microsoft odbc administration' which is under my oracle program group. this created a DSN file and a schema.ini file. Now that's as far as i went. I do not know how to connect to this source throiugh jdbc or if i neeed to configure other settings too. Please, if you have any information let me know as I've been trying to do this on my own for 2 days now.

    what i tried doing is:
            String connectString;
            Class.forName ("sun.jdbc.odbc.JdbcOdbcDriver");
            connectString = "jdbc:odbc:eu.dsn";
            connection = DriverManager.getConnection(connectString);where eu.dsn is the name of the file DSN, which is located in the same directory and under the default directory \program files\common files\odbc\data sources
    i setup this dsn through Oracle's management tools, as i couldnt find the microsoft odbc tool under control panel as some people suggested.
    when i try connecting via the code above i get:
    [Microsoft][ODBC Driver Manager] Data source name not found and no default driver specified
    any ideas?

Maybe you are looking for

  • Lock up and attempted restart on recent recordings

    Recordings made since about 10 days ago are giving me problems. They will lose sound about 1 second before freezing. After about 1 minute the vbox than tries to restart itself, but the restart screen just flickers every 10 seconds like it's recycling

  • About condition for loop in BPM

    I design a loop, condition is counter<>3. It seems only receives 3 messages when I send more than 3. for example, I send 105 messages, for every 10 messages it will generate a file. and I totally have 11 files. What is the best way to end the loop?

  • HELP please: iphone won't open in itunes running OS X 10.5. so cannot get iTunes 11.1.3

    My iPhone 4s with 7.0.2 will no longer open in iTunes! HELP! It says that I need to upadate my iTunes to 11.1.3 but because I am running a Mac OS X 10.5.8 I cannot update my itunes. I need to be able to get into iTunes and I am not willing to get a n

  • PAPI API session.getVar Not working with ALBPM5.7SP1 WE

    Hi, I was using papi api to get processes passing a filter in ALIP 1.5. The following code was working fine: VarDefinition variable = session.getVar(VarDefinition.ACTIVITY_ID); But after I upgraded to ALBPM5.7SP1 WE. The API does not return the varia

  • Function Module for Application Log(SLG1)

    HI SapAll. may i know what is the Function Module  to read the data for Applicaiton Log (tcode-SLG1). waiitng for your response. regards. Varma