xiao sean

Ranch Hand

Posts: 44

posted 9 years ago

hi guys,

i just took my paper and i have serious doubt with my answer in this question.

can anyone work out the answer?

well from what i have work out, my answer is 6. any other answer?

Test Set 1: (0 <= exceededSpeed <= 10, isRepeat = true) to test if we get 0

Test Set 2: (0 <= exceededSpeed <= 10, isRepeat = false) to test if we get 0

Test Set 3: (11 <= exceededSpeed <= 20, isRepeat = true) to test if we get 40

Test Set 4: (11 <= exceededSpeed <= 20, isRepeat = false) to test if we get 20

Test Set 5: (exceededSpeed > 20, isRepeat = true) to test if we get 100

Test Set 6: (exceededSpeed > 20, isRepeat = false) to test if we get 50

in another way.

Test Set 1: (0 <= exceededSpeed <= 10, isRepeat = true) to test if we get a

Test Set 2: (0 <= exceededSpeed <= 10, isRepeat = false) to test if we get b

Test Set 3: (11 <= exceededSpeed <= 20, isRepeat = true) to test if we get c

Test Set 4: (11 <= exceededSpeed <= 20, isRepeat = false) to test if we get d

Test Set 5: (exceededSpeed > 20, isRepeat = true) to test if we get e

Test Set 6: (exceededSpeed > 20, isRepeat = false) to test if we get f

[ May 22, 2008: Message edited by: xiao sean ]

i just took my paper and i have serious doubt with my answer in this question.

can anyone work out the answer?

well from what i have work out, my answer is 6. any other answer?

Test Set 1: (0 <= exceededSpeed <= 10, isRepeat = true) to test if we get 0

Test Set 2: (0 <= exceededSpeed <= 10, isRepeat = false) to test if we get 0

Test Set 3: (11 <= exceededSpeed <= 20, isRepeat = true) to test if we get 40

Test Set 4: (11 <= exceededSpeed <= 20, isRepeat = false) to test if we get 20

Test Set 5: (exceededSpeed > 20, isRepeat = true) to test if we get 100

Test Set 6: (exceededSpeed > 20, isRepeat = false) to test if we get 50

in another way.

Test Set 1: (0 <= exceededSpeed <= 10, isRepeat = true) to test if we get a

Test Set 2: (0 <= exceededSpeed <= 10, isRepeat = false) to test if we get b

Test Set 3: (11 <= exceededSpeed <= 20, isRepeat = true) to test if we get c

Test Set 4: (11 <= exceededSpeed <= 20, isRepeat = false) to test if we get d

Test Set 5: (exceededSpeed > 20, isRepeat = true) to test if we get e

Test Set 6: (exceededSpeed > 20, isRepeat = false) to test if we get f

[ May 22, 2008: Message edited by: xiao sean ]

Campbell Ritchie

Sheriff

Posts: 53774

128

posted 9 years ago

I would have put in a matrix eg, speed 0, 49, 59, 69, 79, 89, 99, 9834756983475, -83745834, 31, 41, 51, 61, 71, 81, 91 first offence and repeat offence speed limit 0, 30, 40, 50, 60, 100, 394593487, -8374534 The reason for the strange numbers is to see what happens if you enter a ridiculous input.

xiao sean

Ranch Hand

Posts: 44

Campbell Ritchie

Sheriff

Posts: 53774

128

posted 9 years ago

Speed limit 0, first offence, speed 0, 9, 11, 21, 31, 41, 51, 61, -9999999

Speed limit 0, not first offence, speed 0, 9, 11, 21, 31, 41, 51, 61, -9999999

Speed limit 10, first offence, speed 0, 9, 11, 21, 31, 41, 51, 61, -9999999

Speed limit 10, not first offence, speed 0, 9, 11, 21, 31, 41, 51, 61, -9999999

Speed limit 50, first offence, speed 0, 9, 11, 21, 31, 41, 51, 61, -9999999

Speed limit 50, not first offence, speed 0, 9, 11, 21, 31, 41, 51, 61, -9999999

Speed limit 1000000, first offence, speed 0, 9, 11, 21, 31, 41, 51, 61, -9999999

Speed limit 1000000, not first offence, speed 0, 9, 11, 21, 31, 41, 51, 61, -9999999

etc

Speed limit 0, not first offence, speed 0, 9, 11, 21, 31, 41, 51, 61, -9999999

Speed limit 10, first offence, speed 0, 9, 11, 21, 31, 41, 51, 61, -9999999

Speed limit 10, not first offence, speed 0, 9, 11, 21, 31, 41, 51, 61, -9999999

Speed limit 50, first offence, speed 0, 9, 11, 21, 31, 41, 51, 61, -9999999

Speed limit 50, not first offence, speed 0, 9, 11, 21, 31, 41, 51, 61, -9999999

Speed limit 1000000, first offence, speed 0, 9, 11, 21, 31, 41, 51, 61, -9999999

Speed limit 1000000, not first offence, speed 0, 9, 11, 21, 31, 41, 51, 61, -9999999

etc

It is sorta covered in the JavaRanch Style Guide. |