Here's my code:
public class Result implements IEvent {
int position;
double time1;
double time2;
double time3;
double time4;
int penalties;
public Result (int aPosition, double t1, double t2, double t3, double t4, int thePenalties) {
this.position = aPosition;
this.time1 = t1;
this.time2 = t2;
this.time3 = t3;
this.time4 = t4;
this.penalties = thePenalties;
}
public double pEarned() {
return this.time1 + this.time2 + this.time3 + this.time4;
}
public double gPenalties() {
return this.penalties * 5;
}
}
Currently, I'm trying to get my test cases to work but I keep getting the error "returnVal cannot be resolved to a variable"
class Examples {
@Test
void testEarned() {
Result P1 = new Result(1, 30, 50, 56, 20, 2);
returnVal = P1.pEarned();
assertTrue(returnVal = 156);
}
@Test
void testPenalties() {
Result P1 = new Result(1, 30, 50, 56, 20, 2);
returnVal = P1.gPenalties();
assertTrue(returnVal = 10);
}
}
I'm new to Java and for this assignment, I'm not supposed to have any inputs for the pEarned and gPenalties methods
Aucun commentaire:
Enregistrer un commentaire