Question: This needs to be written in Java: Output: How many prime numbers do you want? 20 The first 20 prime numbers are: 1 2 2

This needs to be written in Java:  This needs to be written in Java: Output: How many prime

Output:

How many prime numbers do you want? 20 The first 20 prime numbers are:

1 2

2 3

3 5

4 7

5 11

6 13

7 17

8 19

9 23

10 29

11 31

12 37

13 41

14 43

15 47

16 53

17 59

18 61

19 67

20 71

Class PrimeNumbers: o Declare two private fields: integer numberOfPrimes, and array of integers primes o Write a method called getNumberFromUser which prompts the user to enter a value into the numberOfPrimes and create the array for primes field o Write a method called generatePrimes (finds prime numbers based on previous prime numbers) based on the following PDL: START generatePrimes prime so 2 primeNumbers 1 current 3 WHILE primeNumbers

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!