Question: Write a test class to test the method isPrime in Listing 6.7 PrimeNumberMethod. java. Data from Listing 6.7 1 public class PrimeNumber Method { 2
Write a test class to test the method isPrime in Listing 6.7 PrimeNumberMethod. java.
Data from Listing 6.7
![1 public class PrimeNumber Method { 2 pub11c static void main(String[] args)](https://dsd5zvtm8ll6.cloudfront.net/si.question.images/images/question_images/1620/3/6/5/7756094d1cfe62d11620365775203.jpg)

1 public class PrimeNumber Method { 2 pub11c static void main(String[] args) { System.out.printin("The first 50 prime numbers are in"): printPrimeNumbers (50): 3 4 6 publ1c static void printPrimeNumbers (1nt numberofPrimes) { final int NUMBER_OF_PRIMES_PER_LINE = 10: II Display 10 per line 1nt count = 0; II Count the number of prime numbers 7 8 9 10 Int number = 2: II A number to be tested for primeness 11 II Repeatedly find prime numbers wh1le (count < numberofPrimes) { // Print the prime number and increase the count 1f (isPrime(number)) { count++; /7 Increase the count 12 13 14 15 16 17 1f (count % NUMBER_OF_PRIMES_PER_LINE = 0) { II Print the number and advance to the new line 18 19
Step by Step Solution
3.41 Rating (160 Votes )
There are 3 Steps involved in it
public class ABC Main Method public static void main String args int ... View full answer
Get step-by-step solutions from verified subject matter experts
Document Format (2 attachments)
2038_60f58f350c081_871425.pdf
180 KBs PDF File
2038_60f58f350c081_871425.docx
120 KBs Word File
