Question: (a) Write a Java program that will check whether a number, declared and initialised within the program, is a prime number or not. The
(a) Write a Java program that will check whether a number, declared and initialised within the program, is a prime number or not. The program should print out an appropriate message. (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 [20 marks] 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
3.40 Rating (166 Votes )
There are 3 Steps involved in it
The image shows three programming tasks a b and c related to Java programming Below Ill provide sa... View full answer
Get step-by-step solutions from verified subject matter experts
