Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Write a Java program to generate 10 random numbers between 0 and 99, figure out the prime numbers in them, and count the number

Write a Java program to generate 10 random numbers between 0 and 99, figure out the prime numbers in them,

Write a Java program to generate 10 random numbers between 0 and 99, figure out the prime numbers in them, and count the number of prime numbers (hint: consult Section 5.11 in the Textbook on finding prime numbers). The program should implement an is Prime method to test if a number is a prime number as follows: public class HW6_2 { } public static void main(String[] args) { ..... } public static boolean isPrime (int n) The following are two sample runs of the program: Sample run 1 Ten random numbers are: 64 87 92 41 92 19 83 63 87 73 The prime numbers in the list are: 41 19 83 73. The number of prime numbers: 4 Sample run 2 Ten random numbers are: 16 20 68 84 90 18 19 9 65 53 The prime numbers in the list are: 19 53 The number of prime numbers: 2

Step by Step Solution

There are 3 Steps involved in it

Step: 1

Below is a simple Java program that generates 10 random numbers between 0 and 99 finds the prim... blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Introduction to Java Programming, Comprehensive Version

Authors: Y. Daniel Liang

10th Edition

133761312, 978-0133761313

More Books

Students also viewed these Programming questions

Question

Question 2 For an n x n matrix A = form) via (aij)

Answered: 1 week ago

Question

5.8 Evaluate ethnic differences in rates of anxiety disorders.

Answered: 1 week ago