(a) Write a Java program that will check whether a number, declared and initialised within the...
Fantastic news! We've Found the answer you've been seeking!
Question:
Transcribed Image Text:
(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 (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
Expert Answer:
Answer rating: 100% (QA)
The image shows three programming tasks a b and c related to Java programming Below Ill provide sa... View the full answer
Related Book For
Posted Date:
Students also viewed these programming questions
-
Planning is one of the most important management functions in any business. A front office managers first step in planning should involve determine the departments goals. Planning also includes...
-
Let's play a game, use objects, looping constructs and ArrayLists (see bonus) In this project, you will write a "craps" dice program. (History, from Wikipedia: Craps developed from a simplification...
-
In schema normalisation, is Boyce-Codd Normal Form (BCNF) always to be preferred over 3rd Normal Form (4NF)? Explain your answer. [5 marks] 8 (TURN OVER) CST.2004.7.4 8 Economics, Law and Ethics (a)...
-
Under the common law, from the 1500s until today, the law has allowed past property owners to place limitations on the uses of real property in the future through the use of covenants (promises) as...
-
Explain the concept of cross-docking.
-
The trial balance of Hindustan Textiles Ltd. as at 31st March 2006 is as presented hereunder. Further information 1.The authorized capital of the company is 30 lakh equity shares of 10 each of which...
-
Setting materials, labor, and overhead standards is challenging. If standards are set too low, companies might purchase inferior products and employees might not work to their full potential. If...
-
( a 1 ) Calculate the return on shareholders' equity for Ivanhoe in 2 0 2 4 . Note that Ivanhoe's articles of incorporation authorize only common shares. The average return for the shares listed on...
-
Richard McCarthy (born 2/14/64; Social Security number 100-10-9090) and Christine McCarthy (born 6/1/1966; Social security number 101-21- 3434) have a 19-year-old son (born 10/2/99 Social Security...
-
Upon review, the product received is Bird food instead of cat food. Therefore, the Harmonized Tariff number was incorrect. The proper HS # should have been 2309.90.39.35. The duty rate is free for...
-
Two concentrated moments and a couple are acting on the object shown. Given: M = 400 Nm, M = 200 Nm, F = 40 N and d = 2 m. Replace these with a single, equivalent con- centrated moment, and give the...
-
What are the velocity and kinetic energy (in units of eV) of a neutron if its de Broglie wavelength is 10-10m [2pt]? Is it still considered a thermal neutron
-
There is a charged particle with a mass m and a charge q, which moves in a circular motion with a velocity v in a uniform magnetic field. (a) Find the magnitude of the magnetic flux density B. (b)...
-
For the triangle shown in the figure below what are each of the following? (Let y = 40.0 m and r = 50.0 m. Assume the triangle is a right triangle.) X 8 T (a) the length of the unknown side x m (b)...
-
Consider the situation as shown in the figure. The system is released from rest and the block of mass 1 kg is found to have a speed of 0.3 ms after it has descended through a distance of 1 m. Find...
-
Please record the following business transactions of Baiyun Co. for the current year. Jan 1st Issued 100,000 shares of 2 yuan par value common stock to Miss Chames for market price of 3 yuan per...
-
X-1 Find the domain of the function f(x) : x 1 2 - O (-00, -1) U (-1, ) O (-00, 1) U (1, ) O -00, -1) U (-1, 1) U (1, 0) O (- 1, 1)
-
In light of ?our answer to Problem 19.56, propose a mechanism for the formation of 3, 5 -dimethylisoxazole from hydroxylamine and 2, 4-pentanedione. CH 3,5-Dimethylisoxazole
-
Make a graph of potential energy versus angle of bond rotation for propane, and assign values to the energy maxima.
-
Propose a structure for compound E, C7H12O2, which has the following 13C NMR spectral data: Compound E Broadband-decoupled 13C NMR: 19.1, 28.0, 70.5, 129.0, 129.8, 165.8 DEPT-90: 28.0, 129.8 ...
-
Apple stock is selling for \($120\) per share. Call options with a \($117\) exercise price are priced at \($12.\) What is the intrinsic value of the option, and what is the time value?
-
Ibrahim bought 200 shares of a stock trading in the Abu Dhabi Securities Exchange at AED 12 (United Arab Emirates dirham) per share. Over time, the price of the stock increased to AED 18 per share....
-
Refer to Problem 14.9. What would the loss of the seller of the put option be if, at expiration, XLB is trading at \($20?\) What would the profit of the seller be if, at expiration, XLB is trading at...
Study smarter with the SolutionInn App