Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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.

image text in transcribed

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

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Spatial Databases A Tour

Authors: Shashi Shekhar, Sanjay Chawla

1st Edition

0130174807, 978-0130174802

More Books

Students also viewed these Databases questions