Win a copy of Head First Agile this week in the Agile forum!
    Bookmark Topic Watch Topic
  • New Topic

need some major help from you PLEASE  RSS feed

 
Wayne Styles
Ranch Hand
Posts: 45
  • Mark post as helpful
  • send pies
  • Report post to moderator
I need to create a class (within JBuilder) and then add this into another program.
the task says
add a nurse class to the project,
define 2 attributes for nurse class,
define one piece of behaviour for nurse class,
write a nurse constructor,
write code to create a nurse object in the main method and store a referene to that nurse object,
write code to send a messaghe to the nurse object.

Here is what I have so far
package Admin;

import javax.swing.*;

public class Admin{

static int numberOfStaff;
static String[]staffNames;
public Admin(){
}
public static void main(String[]args){
Admin.setThingsUp();
System.out.println("All Data Entered Goodbye");
System.exit(0);
}
private static void setThingsUp(){
while(numberOfStaff < 1 || numberOfStaff > 3)//loop to ensure only 1-3 staff can be entered
{
String userln=JOptionPane.showInputDialog("Enter the number of Nurses presently employed. 3 Maximum");
numberOfStaff=Integer.parseInt(userln);
}
{
staffNames = new String[numberOfStaff];//this added to initialize the array

for (int count = 0 ; count < numberOfStaff; count=count + 1)
{
staffNames[count]=JOptionPane.showInputDialog("Enter the name of the next Nurse.");
continue;
}
}
numberOfStaff = integer.parseInt(userIn);
staffNames=new String[numberOfStaff];
}
}

Any ideas please?
 
Rusty Shackleford
Ranch Hand
Posts: 490
  • Mark post as helpful
  • send pies
  • Report post to moderator
Isn't this a question you posted before? Do you understand what a class is? What are attributes, behavior, constructor? Have you looked at those links I gave you in the thread with this question? There are more links in the FAQ in the top of the beginners forum that can help you as well.

What you need to do is very straightforward, if you understand the concepts. What specifically are you having trouble with. If you are struggling with everything then you need togo over the concepts. I know I sound like a broken record and am not trying to harrass you, but trying to point you in the right direction.

If you have specific questions, please ask them.

http://faq.javaranch.com/view?JavaBeginnersFaq
 
marc weber
Sheriff
Posts: 11343
Java Mac Safari
  • Mark post as helpful
  • send pies
  • Report post to moderator
Wayne,

As Rusty pointed out, this is the same code you posted yesterday in another thread. Please continue this discussion there (where there are already some good suggestions), rather than starting a new thread.
[ August 21, 2006: Message edited by: marc weber ]
 
    Bookmark Topic Watch Topic
  • New Topic
Boost this thread!