Question

# The question asks the condition of Java code with under three conditions.

1) Java code should

accepts an integer from the user and then displays the prim factorization of that number.

2) The application must force the user to enter an integer greater than 1 and must not crash no matter what the user enters.

3) Again, the convention must be work for any integer greater than 1

example of execution)

Enter an integer greater than 1 to be factored: 1

Integer must be greater than 1

Enter an integer than 1 to be factored: 2

1 => 2

Done factoring: 1 factor(s) found for 2.

Enter an integer than 1 to be factored: 3

1 => 3

Done factoring: 1 factor(s) found for 3.

Enter an integer than 1 to be factored: 16

1 => 2

2 => 2

3 => 2

4 => 2

Done factoring: 4 prime factor(s) found for 16.

Enter an integer than 1 to be factored: 4096

1 => 2

2 => 2

3 => 2

4 => 2

5 => 2

6 => 2

7 => 2

8 => 2

9 => 2

10 => 2

11 => 2

12 => 2

Done factoring: 12 prime factor(s) found for 4096.

Enter an integer than 1 to be factored: 189

1 => 3

2 => 3

3 => 3

4 => 7

Done factoring: 4 prime factor(s) found for 189.

I'm not sure where should I start with this question.

I can see the println statement clearly, but not sure how to factor the numbers and distinguish them with factor and prime factor.

Please help me!

#### Top Answer

import java.util.Scanner; public class PrimeFactors { public static void main ( String args[] ) { int number;... View the full answer