Question: Write a program that prompts the user for a number and outputs whether the number is prime. This should be done by creating a class

Write a program that prompts the user for a number and outputs whether the number is prime. This should be done by creating a class that asks for the number and reports the result and a second class that determines if the number is prime.

Examples:

Enter a number: 13 Thinking (this may take a while) The number 13 is prime.

Enter a number: 64000 Thinking (this may take a while) The number 64000 is composite (not prime).

Enter a number: 7919 Thinking (this may take a while) The number 7919 is prime.

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!