Can someone please write this program for me?
Your program will accept as input only unsigned integers in the range 2 .. 65535. If the user enters a value that is invalid, your program must print a helpful error message and prompt the user to enter a new integer.
Your program must be enclosed in a loop that asks the user if s/he wants to factor another integer. Acceptable responses to this prompt are YyNn. Any other input will result in an error message and the user will then be prompted again until s/he enters a valid response. The title line should be printed only one time, and thus will not be in the body of the loop.
Your program output should match the sample output given below, including the repetition of the number being factored in the answer line. There should be no extraneous spaces in that line.
Your program will calculate the prime factors for the input integer and print the answer in the following format:
The factors of XXXX are:
Factor_1Factor_2Factor_3 ...
You must use the algorithm given below to determine the prime factors.
The Algorithm:
Below is a Java method. Given a valid number:
{
String answer = "";
for(int factor=2; factor <= number; factor++) {
if(number % factor == 0) {
answer += factor + "*";
number /= factor;
factor--;
}
}
return answer.substring(0, answer.length()-1);
}