-
Notifications
You must be signed in to change notification settings - Fork 8
oop.pr1 request #6
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
* Project: oop.pr1 | ||
*/ | ||
public class Accountant extends Employee { | ||
private static int countAccountant; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why do you need this field?
return getRatioOfHours() * getSalary(); | ||
} | ||
|
||
public int overallSalary(Employee[] employees) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd prefer to store array/list of employees in the field and do not pass them through argument.
return getRatioOfHours() * getSalary(); | ||
} | ||
|
||
public int overallSalary(Employee[] employees) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why this method returns integer?
} | ||
|
||
public int overallSalary(Employee[] employees) { | ||
double i = 0.; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i
is not the best name for this purpose.
} | ||
|
||
@Override | ||
public double calculateSalary() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why do you override method with exactly the same implementation? I'd prefer to make base method abstract.
* Created by lbrdev on 04.01.2017. | ||
* Project: oop.pr1 | ||
*/ | ||
public class FractionNumberOperations { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please move all these operations inside the FractionNumber class.
} | ||
|
||
public double decimalValue() { | ||
return ((double) dividend) / ((double) divisor); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The only one cast will be enough.
this.dividend = dividend; | ||
this.divisor = DEFAULT_DIVISOR; | ||
} else { | ||
this.dividend = dividend; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There is no need to assign these fields. They will be overridden on the next few lines.
} | ||
|
||
private int gcd(int dividend, int divisor) { | ||
int maxValue; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd prefer to assign values like:
int maxValue = dividend;
int minValue = divisor;
And remove one condition.
|
||
public FractionNumber(int dividend) { | ||
this.dividend = dividend; | ||
this.divisor = 1; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please use default value instead of 1
to check 1, 2