Question: Consider the following example class. PrimeNumbers has three methods. The first, computePrime(), take one integer input and computes that many prime numbers. iterator() returns an

Consider the following example class. PrimeNumbers has three methods. The first, computePrime(), take one integer input and computes that many prime numbers. iterator() returns an Iterator that will iterate through the primes, and toString() returns a string representation.

Consider the following example class. PrimeNumbers has three methods. The first, computePrime(),

computePrimes() has a fault that causes it not to include prime numbers whose last digit is 9 (for example, it omits 19, 29, 59, 79, 89, 109, ...). If possible, describe five tests. You can describe the tests as sequences of calls to the above methods, or briefly describe them in words. Note that the last two tests require the test oracle to be described.

(a) A test that does not reach the fault

(b) A test that reaches the fault, but does not infect

(c) A test that infects the state, but does not propagate

(d) A test that propagates, but does not reveal

(e) A test that reveals the fault

If a test cannot be created, explain why.

public class PrimeNumbers implements Iterable private List primes ArrayList(); = new public void computePrimes (int n) ount 1; // count of primes int c int number - 2; // number tested for primeness boolean isPrime; // is this number a prime while (count iterator() return primes.iteratorO; QOverride public String toString() return primes.toString)

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 Databases Questions!