Skip to content

Conversation

@VynnykVV
Copy link

@VynnykVV VynnykVV commented Dec 8, 2016

1.Employees-done
2.Fraction_Number->halfway
-you can divide by 0
-no objects ONE/TEN

2.Fraction_Number->halfway
-you can divide by 0
-no objects ONE/TEN
@didva didva self-assigned this Dec 10, 2016
Copy link
Contributor

@didva didva left a 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) {
Copy link
Contributor

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;
Copy link
Contributor

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;
Copy link
Contributor

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();
Copy link
Contributor

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");}
Copy link
Contributor

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 {
Copy link
Contributor

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;
Copy link
Contributor

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){
Copy link
Contributor

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;
Copy link
Contributor

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();
Copy link
Contributor

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants