Answered step by step
Verified Expert Solution
Link Copied!

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: image text in transcribed

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

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

Visual Basic 4 Ole Database And Controls Superbible

Authors: Michael Hatmaker, C. Woody Butler, Ibrahim Malluf, Bill Potter

1st Edition

1571690077, 978-1571690074

More Books

Students also viewed these Databases questions

Question

What are the limitations of forward markets?

Answered: 1 week ago

Question

5. Understand how cultural values influence conflict behavior.

Answered: 1 week ago