You will write three methods in this questions. The first method called inputGetter will check the input if it is a positive integer. It will ask for a new input until the user enters a positive integer and returns the valid integer N. Then, this integer N will be utilized as a parameter for the second method called primeFactorization. This method will get the number N and returns a two-dimensional array that shows the prime factors and how many times each factor exists in this number. The first element of the array will be the prime factor, the second element will show how many times this factor exists. Then, the last method print will get this array and prints all elements as exactly as it is shown in the output example runs.
You will write three methods in this questions. The first method called
inputGetter will check the input if it is a positive integer. It will ask for a new input until the
user enters a positive integer and returns the valid integer N. Then, this integer N will be
utilized as a parameter for the second method called primeFactorization. This method will get
the number N and returns a two-dimensional array that shows the prime factors and how
many times each factor exists in this number. The first element of the array will be the prime
factor, the second element will show how many times this factor exists. Then, the last method
print will get this array and prints all elements as exactly as it is shown in the output example
runs.
Step by step
Solved in 2 steps with 1 images