Question: The PrimeDecomposer Program Write a java program the generates the prime factorization of an integer. The program should prompt the user to enter an integer


The PrimeDecomposer Program Write a java program the generates the prime factorization of an integer. The program should prompt the user to enter an integer and compute its prime decomposition. If the user enters an integer that is less than two, the program displays a message indicating that only integers greater than or equal to two can be expressed as a product of prime factors. If the user enters an integer greater than or equals to two, the program generates the prime decomposition of the integer. To generate the prime factorization of an integer, the program follows these steps: 1. It determines the smallest prime factor of the number. 2. It counts the number of times that the smallest factor appears as a factor of the number. For every update of the count, it updates the number by replacing it with the quotient of the current value of the number and the factor. 3. It displays the first power of a prime factor as shown in the sample run. It should not display 4. As long as the number is not one, it does the following: (a) It determines the next factor of the number. (b) It counts the number of times that the next factor appears as a factor of the number. For every update of the count, it updates the number by replacing it with the quotient of the current value of the number and the factor. (c) It displays the power of the factor as shown in the sample run. It should not display one as an exponent. Assignment No 5 Page 1
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
