Results 1 to 7 of 7
- 07-06-2010, 12:47 PM #1Hamodi18 Guest
- 07-06-2010, 01:20 PM #2
Member
- Join Date
- Jul 2010
- Posts
- 1
- Rep Power
- 0
I think it is too easy.You should do it yourself before needing someone's help.
- 07-06-2010, 01:41 PM #3
Is there a question about java programming here?
- 07-06-2010, 03:06 PM #4
i guess Hamodi18 doesn't know where and how to begin. so I wrote the superclass and the worker class as starters for you and i hope you can implement all the other requirements. so, you should be able to post a concrete question about java next time.
Java Code:public abstract class Worker { // here are the instance variables, not visible outside the class private String Id; private String name; private String dep; // the constructor that initialize your instance variables public Worker(String Id, String name, String dep) { this.Id = Id; this.name = name; this.dep = dep; } // the abstract method abstract double CalculateSalary(); public String getId() { return Id; } // all getters and setters public void setId(String id) { Id = id; } public String getName() { return name; } public void setName(String name) { this.name = name; } public String getDep() { return dep; } public void setDep(String dep) { this.dep = dep; } }
Java Code:public class Hourly extends Worker { int hoursWorked; double hourlyRate; // first constructor public Hourly(String Id, String name, String dep) { super(Id, name, dep); } // second constructor with hours worked and hourly rate public Hourly(String Id, String name, String dep, int hoursWorked, double hourlyRate) { super(Id, name, dep); // set hoursWorked and hourlyRate setHoursWorked(hoursWorked); setHourlyRate(hourlyRate); } public int getHoursWorked() { return hoursWorked; } public void setHoursWorked(int hoursWorked) { this.hoursWorked = hoursWorked; } public double getHourlyRate() { return hourlyRate; } public void setHourlyRate(double hourlyRate) { this.hourlyRate = hourlyRate; } // the class Hourly must implement the abstract method public double CalculateSalary() { return hoursWorked * hourlyRate; } }
hope, this is not too much help.
- 07-06-2010, 03:14 PM #5
I don't understand how giving someone a fish teaches him how to fish.
- 07-06-2010, 03:21 PM #6
Nor do I.
@OP: Read this: Starting Writing a ProgramMath problems? Call 1-800-[(10x)(13i)^2]-[sin(xy)/2.362x]
The Ubiquitous Newbie Tips
- 07-07-2010, 05:04 AM #7
Senior Member
- Join Date
- Feb 2010
- Location
- Waterford, Ireland
- Posts
- 748
- Rep Power
- 4
Similar Threads
-
Custom professional objects/package
By Dimebag in forum New To JavaReplies: 1Last Post: 05-31-2010, 06:09 PM -
J2EE, PHP, Linux, MySql, CSS, HTML Development Professional
By softdev in forum Reviews / AdvertisingReplies: 1Last Post: 01-17-2008, 11:52 AM -
Onsite UK for Java/J2EE Professional
By aman_max1981 in forum Reviews / AdvertisingReplies: 0Last Post: 11-23-2007, 11:02 AM -
SDE for Eclipse Professional Edition 4.1 sp1
By JavaBean in forum Java SoftwareReplies: 0Last Post: 10-16-2007, 06:47 PM -
SDE for Eclipse Professional Edition 4.0 SP2
By levent in forum Java SoftwareReplies: 0Last Post: 05-22-2007, 07:13 AM


LinkBack URL
About LinkBacks
Reply With Quote

Bookmarks