how to write this class?

Hi there

I have asked to write a class which called "Worker" which contain methods and fields related to the following requrirements:

- A worker should have a number allocated sequentially starting from 122.
- the class should know the number of tasks required and whether Morning or evening, in first floor or in second floor, require wearing a uniform or not.
- if the task has allocated to another worker, it should know who is that worker and how much does he take for this work.

I think it does need another class, for examlpe (AnotherWorker). :rolleyes:

Can you help me.. just tell me what should I use of methods and fields... tell me as possible as you can.

Yeah I know that, but I just want you to give me idea not how to write the source code, but about what should it contain. For example, you can tell me you should have three fields one for... and one for.. and the last one for... Also you should have a mthod which does... etc

public class Worker
{
private int startNumber; // should be a more intuitive name like first employee
private int numberOfTasks;
private String duration;
//this is your constructor you cant even comprehend passing variables to it
Worker()
{
startNumber= 122;
no = numberOfTasks;//who determines the number of tasks
duration="";//duration = a blank string now
}
public void morning()
{
duration="Morining";
}
public void evening()
{
duration="Evening";
}
//.....
}// where is your main method????????????????

you dont even know how to compile code nor have the j2se installed on your system or a third party editor like textpad or a fully lloaded ide like netbeans. compile a hello program on your computer and come back here