Question: the given code: public static int LicencePoints ( int actualSpeed, int maxSpeed, boolean stuntDriving ) { int points = 0 ; if ( actualSpeed <

the given code:
public static int LicencePoints(int actualSpeed, int maxSpeed, boolean stuntDriving){
int points =0;
if (actualSpeed <0|| maxSpeed <0) return -1;
else if (actualSpeed - maxSpeed <0) return -1;
else if (stuntDriving || actualSpeed - maxSpeed >=50) points =6;
else if (actualSpeed - maxSpeed >=30 && actualSpeed - maxSpeed <=49) points =4;
else if (actualSpeed - maxSpeed >=16 && actualSpeed - maxSpeed <=29) points =3;
return points;
write a set of JUnit test cases that comprehensively test the
given code. A comprehensive set of test cases is one that not only checks if
the expected output is the same as the actual output, as described in the
specification above but also traverses all paths in the code. If there is a
conditional statement, both the true and false conditions should be tested.
For multiple conditions, all possible combinations of the conditions being true
or false should be tested. This means if the condition is "A AND B," four
different test cases should be written, unless it is not possible. The four
conditions are: A=True, B=True A=True, B=False - A=False, B=True
A=False, B=False.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!