Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

(a) Write a Java program that will check whether a number, declared [50 marks] and initialised within the program, is a prime number or not.

image text in transcribed
(a) Write a Java program that will check whether a number, declared [50 marks] and initialised within the program, is a prime number or not. The program should print out an appropriate message. [10 marks] (b) Write a Java program that will create an array of integers of size [20 marks] 10. The program should randomly fill the array with integer numbers between 0 and 1000 . The program should then print the contents of the array to the screen. The program should then get the sum of the array contents and also calculate the average of the numbers in the array and print these results to the screen. (c) Write a Java program that will determine if a String, inputted from the user, is a palindrome. A String is a palindrome if the word remains the same when spelled in reverse as it does forwards, ignoring the case of the letters. For example: NAVAN, navan, NavAn are palindromes CAVAN is NOT a palindrome

Step by Step Solution

There are 3 Steps involved in it

Step: 1

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_2

Step: 3

blur-text-image_3

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

Practical Database Programming With Visual Basic.NET

Authors: Ying Bai

1st Edition

0521712351, 978-0521712354

More Books

Students also viewed these Databases questions

Question

6. Have you used solid reasoning in your argument?

Answered: 1 week ago