Question: Please help! code in C++ You will write code to empirically compare the performance of a brute-force and the Sieve of Eratosthenes algorithms for generating

Please help! code in C++

You will write code to empirically compare the performance of a brute-force and the Sieve of Eratosthenes algorithms for generating all prime numbers in the interval [0, n], where n is an integer. Use the provided PrimeGenerator.h file (linked below) that contains the definition of the PrimeGenerator class and prototypes for relevant functions. Do not make any change to this file! The file is listed below, as follows:

https://drive.google.com/file/d/1r8XR0mZANu2el3BLYb9QCWkCU2MUFGDZ/view?usp=sharing

The PrimeGenerator Implementation

Provide a file, PrimeGenerator.cpp (shown below), that implements the member functions of the PrimeGenerator class defined in the header file. See PrimeGenerator.h for detailed documentation and specifications of functions whose implementations you will provide in this file.

Please help! code in C++ You will write code to empirically compare

The PrimeGeneratorDemo Class

The main function will perform the following tasks:

1. It prompts the user to enter a positive integer n.

2. It determines whether or not n is a prime number.

3. It displays a list of prime numbers in [1, n].

4. It displays the largest prime number in [1, n].

5. It displays the number of prime numbers in [1, n].

6. It randomly generates a prime number in [1, n].

7. It creates prime number generators with various lengths using the brute-force and Sieve of Eratosthenes algorithms. For each length, your program will measure and display the execution times in nanoseconds as shown in the table in the sample run.

Additional Requirements

Test the program to ensure that it works correctly and generates its output in the same format as shown in the sample run. Each file should have the following javadocs:

/** * EXPLAIN THE PURPOSE OF THIS FIlE

* CSC 3102 Programming Project # 0

* @author YOUR NAME

* @since DATE THE FILE WAS LAST MODIFIED

* @see A LIST OF FILES THAT IT DIRECTLY REFERENCES */

Your output should look something like this:

the performance of a brute-force and the Sieve of Eratosthenes algorithms for

*A test bed for the PrimeGenerator implementation. * Qauthor Duncan, YOUR NAME Osince 99-99-9999 @see PrimeGenerator.h #include #include #include #include #include "PrimeGenerator.h" using namespace std; int main(int argc, char** argv) cout

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!