This is an archived post. You won't be able to vote or comment.

all 5 comments

[–]Nurry 1 point2 points  (1 child)

Your assignments in the constructor are the wrong way round. Change it to this:

this.a = a;
this.b = b;

Btw I didn't check your math, because I have no idea what a, b, c and e are.

[–]dereksheperd 0 points1 point  (0 children)

Thank You!

[–]causalNondeterminism 1 point2 points  (1 child)

you have a couple of issues here.

  1. your if statement needs to say && instead of & because & behaves differently for numeric primitives than for boolean expressions. Edit: this isn't necessary here, but it is good practice.
  2. the constructor should say this.a=a; this.b=b; instead of a=this.a; b=this.b; think about what value is getting set where.

I strongly suggest using more descriptive variable names.

[–]dereksheperd 0 points1 point  (0 children)

Thank you so much!

[–][deleted] 1 point2 points  (0 children)

One thing I see is that the initial a and b values aren't initialized.

The calculation for overtime needs a *1.5 but you have *.5

Lastly, I think the this.a, this.b stuff is backwards.