Question: JAVA programming Program that displays the prime numbers from the list of factors of a random generated even number in reverse order Example, 18, the

JAVA programming

Program that displays the prime numbers from the list of factors of a random generated even number in reverse order

Example, 18, the factors are 1,2,3,6 and 9. Therefore, prime numbers are 2,3. Program will then print 3, 2 in that order.

Step 1) FINISHED

//NumberInt method generates random number between range 50 100, returning even

public static int NumberInt(){

Random randNumber = new Random();

int randNumberInt = 50 + randNumber.nextInt((100 50)/2) * 2;

return randNumberInt;

}

Step 2)

//Write method Factors

//Method will be called in the main method and passed generated even

//Method will store factors of the even number in a queue and will return it

public static Queue Factors(int num){

Queue factors = new Queue();

//Add your code

return factors;

}

Step 3)

//Write method FindPrimes

//Method will store the prime numbers from the list of factors and returns it

public static Stack FindPrimes(Queue aQeueue){

Stack primes = new Stack();

//Add your code

return primes;

}

Step 4)

//Write method printPrimes

//Method takes the stack of printPrimes as parameter

//Method displays all prime factors and doesnt return value

Step 5)

*Testing methods

public static void main(String...strings){

//NumberInt()

//Factors() method passing the returned value of NumberInt()

//FindPrimes() method passing the return queue of Factors()

//printPrimes() method passing the return stack of FindPrimes()

}

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!