-
Notifications
You must be signed in to change notification settings - Fork 8
Task 1-100%, Task 2-80% #2
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
2.Fraction_Number->halfway -you can divide by 0 -no objects ONE/TEN
didva
left a comment
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 add 3rd task, fix comments and format your code.
| public FractionNumber() { | ||
| } | ||
|
|
||
| public FractionNumber(int Numerator, int Denominator) { |
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 read java convention. All variables, fields and method arguments should be named on lowerCamelCase.
|
|
||
|
|
||
| final int def = 1; | ||
| protected int Numerator; |
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 these fields on the top of the class.
| protected int Numerator; | ||
| protected int Denominator; | ||
|
|
||
| int a = Numerator; |
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 variables a, b?
| Ad = Ad * aN; | ||
| An = An * aD; | ||
| FractionNumber b = new FractionNumber(An, Ad); | ||
| b.Normalized(); |
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.
Normalization should be done right on object creation. So please move it to constructor.
| public FractionNumber(int Numerator, int Denominator) { | ||
| this.Numerator = Numerator; | ||
|
|
||
| if(Denominator==0){System.out.println("WRONG");} |
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.
System.out.println("WRONG"); is not the case. Please set denominator to 1 or throw exception.
| /** | ||
| * Created by User on 05.12.2016. | ||
| */ | ||
| public class 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.
Employee is most likely better name for this class.
|
|
||
|
|
||
|
|
||
| protected String name; |
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 fields on the top of the class.
| * Created by User on 05.12.2016. | ||
| */ | ||
| public class Employees { | ||
| public Employees(String nameE,int workHoursE){ |
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.
Not sure it's a good way to pass worked hours via constructor. I'd prefer add method like work(int hours) or simple setWorkedHours(int hours).
| * Created by User on 05.12.2016. | ||
| */ | ||
| public class Accountant extends Employees { | ||
| 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.
There is no need to count all objects that were created.
| public Accountant(String nameE, int workHoursE) { | ||
| super(nameE, workHoursE); | ||
| countAccountant++; | ||
| Manager.SalaryOverAll=Manager.SalaryOverAll+getSalary(); |
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.
Accountant should contain array of employees and calculate their salary instead of static fields.
You should avoid static fields/methods everywhere it possible.
1.Employees-done
2.Fraction_Number->halfway
-you can divide by 0
-no objects ONE/TEN