I'm not sure what I am doing wrong. any help would be much appreciated.

Business, Finance, Economics, Accounting, Operations Management, Computer Science, Electrical Engineering, Mechanical Engineering, Civil Engineering, Chemical Engineering, Algebra, Precalculus, Statistics and Probabilty, Advanced Math, Physics, Chemistry, Biology, Nursing, Psychology, Certifications, Tests, Prep, and more.
Post Reply
answerhappygod
Site Admin
Posts: 899603
Joined: Mon Aug 02, 2021 8:13 am

I'm not sure what I am doing wrong. any help would be much appreciated.

Post by answerhappygod »

I'm not sure what I am doing wrong. any help would be muchappreciated.
I M Not Sure What I Am Doing Wrong Any Help Would Be Much Appreciated 1
I M Not Sure What I Am Doing Wrong Any Help Would Be Much Appreciated 1 (57.29 KiB) Viewed 20 times
Write the procedure named SwapEnds (). You'll find the file (Swap Ends.java) in this week's code folder.) Here are the specifications: The SwapEnds () procedure is passed an array of ints named nums. You should swap the first and last elements in the array. Since this is a procedure, you won't have any return value. (The array length will be at least 1.) Here are the Javadoc tags: @param nums an array of int to be modified. • No @return because this is a procedure. Here are some examples: swapEnds ({1, 2, 3, 4}) changes nums to {4, 2, 3, 1} swapEnds ({1, 2, 3}) changes nums to {3, 2, 1} swapEnds ({8, 6, 7, 9, 5}) changes nums to {5, 6, 7, 9, 8} SwapEnds.java 1 public class SwapEnds 2 { 3 public int[] swapEnds (int[] numbers) { 4567890 9 } 10 } int swap = numbers [0]; numbers [0] = numbers [numbers.length - 1]; numbers [numbers. length 1] = temp; return numbers;
Join a community of subject matter experts. Register for FREE to view solutions, replies, and use search function. Request answer by replying!
Post Reply