Question: I need help with the flowchart! A prime number is an integer greater than 1 whose only factors are 1 and itself. A factor is

I need help with the flowchart!

A prime number is an integer greater than 1 whose only factors are 1 and itself. A factor is an integer that can be divided evenly into another number. For example, 6 is not a prime number because it has 1, 2, 3 ,6 as its factors. While 11 is a prime number because the factors of 11 are only 1 and 11. The first few prime numbers are 2, 3, 5, 7, 11, 13, 17, 19, 23 and 29.

Write a method isPrime() with a formal parameter of int type, and aboolean type return to check if a number is a prime number. When a number is prime, return true, otherwise, return false.

Ask an input from console, show all the prime numbers from 2 to the number of your input. You need to call the method isPrime in your main method.

The result should be in following format:

2, 3, 5, 7 .

Requirements:

  1. Define the method with a formal parameter of int type, and aboolean type return
  2. Create a flowchart of your design for both main method and isPrime method.
  3. Ask an input from console and use number 1000 as input to test and take a screenshot of this result.

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!