logo Use CA10RAM to get 10%* Discount.
Order Nowlogo

Implement a Java method that takes as arguments an array and another value.

INSTRUCTIONS TO CANDIDATES
ANSWER ALL QUESTIONS

Implement a Java method that takes as arguments an array and another value. The method returns the position (index) of the value in the array. For example, given an array {21, 3, 67, -8} and value 3, the routine should return 1 (since 3 occurs at position 1 in the array (what is the first index in a Java array?)).

If the value is not found in the array, return -1. Your method should accept generic parameters so that arrays and values of various types can be passed in. Any single method call will pass in a value and an array of the same type. Write your method to be as flexible as possible in other ways as well; e.g. do not hard-code the length of the array that is passed in. This method does not output anything to the screen. From a separate class, call your method from main and demonstrate it working with arrays of at least three different types and sizes. Be sure to demonstrate at least one case where the value is not found in the array.

The results of the method calls should be printed to the screen from here. Submission Requirements Please submit here: Source files. This is one or more .java files that contain your original source code. Java source files have .java extensions, and they are human readable in a text editor! Screenshots. One or more screenshots demonstrating your program running on your development workstation. Be sure to capture all program output, and be sure that your output is produced by your program!

 

Related Questions

. Introgramming & Unix Fall 2018, CRN 44882, Oakland University Homework Assignment 6 - Using Arrays and Functions in C

DescriptionIn this final assignment, the students will demonstrate their ability to apply two ma

. The standard path finding involves finding the (shortest) path from an origin to a destination, typically on a map. This is an

Path finding involves finding a path from A to B. Typically we want the path to have certain properties,such as being the shortest or to avoid going t

. Develop a program to emulate a purchase transaction at a retail store. This program will have two classes, a LineItem class and a Transaction class. The LineItem class will represent an individual

Develop a program to emulate a purchase transaction at a retail store. Thisprogram will have two classes, a LineItem class and a Transaction class. Th

. SeaPort Project series For this set of projects for the course, we wish to simulate some of the aspects of a number of Sea Ports. Here are the classes and their instance variables we wish to define:

1 Project 1 Introduction - the SeaPort Project series For this set of projects for the course, we wish to simulate some of the aspects of a number of

. Project 2 Introduction - the SeaPort Project series For this set of projects for the course, we wish to simulate some of the aspects of a number of Sea Ports. Here are the classes and their instance variables we wish to define:

1 Project 2 Introduction - the SeaPort Project series For this set of projects for the course, we wish to simulate some of the aspects of a number of

Ask This Question To Be Solved By Our ExpertsGet A+ Grade Solution Guaranteed

expert
Um e HaniScience

802 Answers

Hire Me
expert
Muhammad Ali HaiderFinance

910 Answers

Hire Me
expert
Husnain SaeedComputer science

880 Answers

Hire Me
expert
Atharva PatilComputer science

688 Answers

Hire Me

Get Free Quote!

265 Experts Online