Answered step by step
Verified Expert Solution
Question
00
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.
(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
Get Instant Access with AI-Powered Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started