Answered step by step
Verified Expert Solution
Question
1 Approved Answer
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:
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
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started