Within the package define a class called Helper, containg the following methods:
a) A constructor (with one parameter, name).
b) A constructor (with two parameters, name and hours worked).
c)getHours - method returns the number of hours worked.
d) setHours- private method sets the number of hours worked
e) getALL - prints all the data feilds with 1 record ( name, hours_ per line.
the private member data fields are called name and hours. There are no othger methods in this class at this stage.
I am just beginning learning java, and this is just the first part of a long list of questions, so if someone can help me with the start, then i can do the rest. thankyou so much.
What is your question? I usually recognize them because they end with a ?
Does your text book have any examples? Can you tailor one of them to get started with your problem? If you'll do that and then ask questions on how to make your program do what you want it to do, then we'll help.
So get started and post what you have to date with your questions about how to make it to what is needed.
I have got to agree with norm on this one. What is your question?
You have almost all the information you need to define your Helper class - you have data members and you have methods. Look at your instructional materials and study how classes are defined, and copy that pattern with your Helper class.
Sorry, it goes on to say:
Test the just defined class using another class HelperWork, which uses the following data: (Tim Brown worked 35 hours)
Tim Brown 35
In other words create an object , called creature, of type Helper with the above values and display theses values on screen. The values form a part of the java code. This class contains only the main method with no further methods will be added here.
Next, create 2 arrays Names and Work containing the names and hours, given below ( data are part of the program, they are not entered by the keyboard):
Tim Brown 35
Jack Blink 50
Pat Gold 34
Jim Done 22
Eloise Tricot 71
Modify your main method and create an array of Helper class objects, using the arrays Names and work representing 5 helpers with hours each of them worked.
(2)Write a method "alterHours" that increase the hours by 20%?
Modify the variables storing the hours worked by Pat and Eloise, using the "alterHours" method, display the new values.
(3) Find the average number of hours worked by the helpers.
Guuys I just started, so Iím really confused, so any help would be greatly appreciated, thankyou so much for replying
Ok, so now you've typed in the whole assignment. But you haven't written any code yet to attempt the solution. You need to break the problem down into small steps and solve them one by one.
What have you written to date? Post it with specific questions about how to do each thing it needs to do. You learn a lot by doing. Try different things,
Top DevX Stories
Easy Web Services with SQL Server 2005 HTTP Endpoints
JavaOne 2005: Java Platform Roadmap Focuses on Ease of Development, Sun Focuses on the "Free" in F.O.S.S.
Wed Yourself to UML with the Power of Associations
Microsoft to Add AJAX Capabilities to ASP.NET
IBM's Cloudscape Versus MySQL