Write a method called isFound that accepts as an arguments an array of integers (call numArr) and
Fantastic news! We've Found the answer you've been seeking!
Question:
Write a method called isFound that accepts as an arguments an array of integers (call numArr) and and an integer variable (call it x). The method returns true or false depending if x was found in numArr or not.
- Demonstrate the method by calling it from the main() and passing to it an array of integers (declare and initialize with 10 values in the main()) and a value to search for. Print a message telling the user if the value x was found or not in the main();
Question 2:
Write a method called addArr that accepts as an arguments an array of integers (call numArr). The method returns the sum of all the values in it.
- Demonstrate the method by calling it from the main() and passing to it an array of integers (declare and initialize with 10 random values generated using the Random class in the range 1-100. Print the sum in the main().
Question 3:
Write a method called copyRev that accepts as an arguments an array of integers (call numArr). The method will create another array (call it revNumArr) and fill it with the elements of numArr in reverse order.
- Demonstrate the method by calling it from the main() and passing to it an array of integers (declare and initialize with 10 random values generated using the Random class in the range 1-100. Print the elements of numArr and revNumArr in the copyRev().
Related Book For
Java An Introduction To Problem Solving And Programming
ISBN: 9780134462035
8th Edition
Authors: Walter Savitch
Posted Date: