Results 1 to 13 of 13
- 06-13-2012, 04:56 PM #1
Member
- Join Date
- Jun 2012
- Posts
- 5
- Rep Power
- 0
can anyone help me out with my hw?
hello.
i've been trying to figure out this exercise all day.. the first exercise was hard enough, but i finally figured that one out, but this one is really confusing me..

nothing i do seems to work. and its really frustrating me that seem to understand wtf i have to do.. if anyone could offer tips, i would very much appreciate it
- 06-13-2012, 05:00 PM #2
Re: can anyone help me out with my hw?
Is this a java programming problem? Post your code and your questions.
If you don't understand my response, don't ignore it, ask a question.
- 06-13-2012, 05:18 PM #3
Member
- Join Date
- Jun 2012
- Posts
- 5
- Rep Power
- 0
- 06-13-2012, 05:22 PM #4
Re: can anyone help me out with my hw?
There must be some ideas in your class notes. I'm not familiar with what the picture represents.
If you don't understand my response, don't ignore it, ask a question.
- 06-13-2012, 05:25 PM #5
- Join Date
- Sep 2008
- Location
- Voorschoten, the Netherlands
- Posts
- 11,385
- Blog Entries
- 7
- Rep Power
- 17
Re: can anyone help me out with my hw?
Here are the first steps;
You fill in the details ...Java Code:public interface Person { ... } public class Employee implements Person { ... } public class Manager extends Employee { ... }
kind regards,
JosWhen people rob a bank they get a penalty; when banks rob people they get a bonus.
- 06-13-2012, 05:40 PM #6
Member
- Join Date
- Jun 2012
- Posts
- 5
- Rep Power
- 0
Re: can anyone help me out with my hw?
hey jos, thanks for this. but some of them are set to private and such
• +: public, -: private, #:protected, ~:default
• Employee is paid a rate per hour.
• Manager is paid above + bonus.
does that make things more complicated or? in any case, i'll try to work it out with how you suggested, and let you know if i got it working
- 06-13-2012, 05:50 PM #7
- Join Date
- Sep 2008
- Location
- Voorschoten, the Netherlands
- Posts
- 11,385
- Blog Entries
- 7
- Rep Power
- 17
Re: can anyone help me out with my hw?
Those +, -, # and ~ thingies are only another notation for private/public/etc. member variables and methods. It's a one-to-one translation to Java code; there's nothing complicated about it.
kind regards,
JosWhen people rob a bank they get a penalty; when banks rob people they get a bonus.
- 06-13-2012, 05:57 PM #8
Moderator
- Join Date
- Apr 2009
- Posts
- 10,438
- Rep Power
- 16
Re: can anyone help me out with my hw?
Oh come on, since you can clearly read the diagram then why have you not at least got the skeleton of the classes and interface in place?
Please do not ask for code as refusal often offends.
- 06-13-2012, 06:00 PM #9
Member
- Join Date
- Jun 2012
- Posts
- 5
- Rep Power
- 0
Re: can anyone help me out with my hw?
this is what i have done so far for the employee class
package payroll;
public class Employee implements Person {
private int hoursWorked;
private float payRate;
public int gethoursWorked(){
return this.hoursWorked;
}
public void sethoursWorked(int hoursWorked){
this.hoursWorked = hoursWorked;
}
private float getpayRate(){
return this.payRate;
}
private void setpayRate(float payRate){
this.payRate = payRate;
}
}
i got one question, the "get wage" is confusing me a bit... do i just do a getter for both classes and no setters?
- 06-13-2012, 06:08 PM #10
Moderator
- Join Date
- Apr 2009
- Posts
- 10,438
- Rep Power
- 16
Re: can anyone help me out with my hw?
Yes, as that's what the design says.
Note the capitalisation of the method names, though.
Yours are incorrect as they stand.Please do not ask for code as refusal often offends.
- 06-13-2012, 06:34 PM #11
Member
- Join Date
- Jun 2012
- Posts
- 5
- Rep Power
- 0
- 06-13-2012, 07:31 PM #12
- Join Date
- Sep 2008
- Location
- Voorschoten, the Netherlands
- Posts
- 11,385
- Blog Entries
- 7
- Rep Power
- 17
Re: can anyone help me out with my hw?
Those funny characters have nothing to do with capitalization whatsoever; Tolls was talking about, say, a member variable 'foo'; its getter and setter methods should look like getFoo() and setFoo( ... ). Check your method names again and especially their CamelCase capitalization.
kind regards,
JosWhen people rob a bank they get a penalty; when banks rob people they get a bonus.
- 06-14-2012, 09:39 AM #13
Moderator
- Join Date
- Apr 2009
- Posts
- 10,438
- Rep Power
- 16


LinkBack URL
About LinkBacks
Reply With Quote

Bookmarks