Write a program that prompts the user for an integer, then asks user to enter that many integer value. Store these values in an integer array and print the array. Reverse the array elements so that first element become the last element, the second element become the second to last element, and so on, with the old last element now first. Do not just reverse the order in which they are printed; actually, change the way they are stored in the array. Try not to create a second array; just rearrange the elements within the array you have. (Hints; Swap elements that need to change place.) When the elements have been reversed, Print the array again.

EBK JAVA PROGRAMMING
9th Edition
ISBN:9781337671385
Author:FARRELL
Publisher:FARRELL
Chapter8: Arrays
Section: Chapter Questions
Problem 9PE
icon
Related questions
Question

Write a program that prompts the user for an integer, then asks user to enter that many integer value. Store these values in an integer array and print the array.

Reverse the array elements so that first element become the last element, the second element become the second to last element, and so on, with the old last element now first. Do not just reverse the order in which they are printed; actually, change the way they are stored in the array. Try not to create a second array; just rearrange the elements within the array you have.

(Hints; Swap elements that need to change place.) When the elements have been reversed, Print the array again.

Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 3 steps with 1 images

Blurred answer
Knowledge Booster
Array
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
EBK JAVA PROGRAMMING
EBK JAVA PROGRAMMING
Computer Science
ISBN:
9781337671385
Author:
FARRELL
Publisher:
CENGAGE LEARNING - CONSIGNMENT
C++ Programming: From Problem Analysis to Program…
C++ Programming: From Problem Analysis to Program…
Computer Science
ISBN:
9781337102087
Author:
D. S. Malik
Publisher:
Cengage Learning