Answered step by step
Verified Expert Solution
Question
1 Approved Answer
1. Write the method makeNegativeArray(int [] nums). This method should create and return a new int [] of values that contain elements that are the
1. Write the method makeNegativeArray(int [] nums). This method should create and return a new int [] of values that contain elements that are the negatives of the elements in nums. You may assume that nums is not null (that it has at least one value in it).
Ex) int [] x = {2, 4, -3, 6, -4, -1, 0}
int [] y = makeNegativeArray(x);//y holds {-2, -4, 3, -6, 4, 1, 0}
// pre: nums is not null
// post: a new int [] containing negative version of elements in nums
public static int[] makeNegativeArray(int [] nums)
{
}
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored 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