Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

10. Reversing the elements of an array involves th exchanging the corresponding elements of e array: the first with the last, the second with the

image text in transcribed
10. Reversing the elements of an array involves th exchanging the corresponding elements of e array: the first with the last, the second with the next to the last, and so on, all the way to the middle of the array. For example, if the array has 4 elements: (80, 85, 95, 100), we want to reverse the elements so that the array becomes (100, 95, 85, 80). Given an array a, write a loop that reverses the elements of the array. You may declare additional variables as needed. (For full credit, invoke one of the swap methods from question 9 appropriately.) 11. Write a method that receives a String as a parameter, creates a new String that contains the same characters in the specified String but in reverse order, and returns that String. For example, if the String received as a parameter is "loop, the method should return "pool. Your method should work for any String. You will need to appropriately invoke the charAt method of the String class. Its description in the Java standard library is: char charAt (int index) Returns the char value at the specified index

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

Step: 3

blur-text-image

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

Main Memory Database Systems

Authors: Frans Faerber, Alfons Kemper, Per-Åke Alfons

1st Edition

1680833243, 978-1680833249

More Books

Students also viewed these Databases questions