Problem No. 2  Write a Java class called ContainsInRange. This class defines a method called contains(), which takes as parameters an integer array a, an integer x, an int called start, as well as an int called end, and returns a boolean which is true if and only if x occurs in a at a position which is greater than or equal to start, and less than end. You must validate that start is less than or equal to end, and that both start and end are greater than or equal to 0, and less than or equal to a.length. Repeat the operation often. (please put also the code that the user can enter a value. Thank you)

EBK JAVA PROGRAMMING
9th Edition
ISBN:9781337671385
Author:FARRELL
Publisher:FARRELL
Chapter8: Arrays
Section: Chapter Questions
Problem 20RQ
icon
Related questions
Question

Problem No. 2 

Write a Java class called ContainsInRange. This class defines a method called contains(), which takes as parameters an integer array a, an integer x, an int called start, as well as an int called end, and returns a boolean which is true if and only if x occurs in a at a position which is greater than or equal to start, and less than end. You must validate that start is less than or equal to end, and that both start and end are greater than or equal to 0, and less than or equal to a.length. Repeat the operation often. (please put also the code that the user can enter a value. Thank you)

Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 3 steps with 1 images

Blurred answer
Knowledge Booster
Adjacency Matrix
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
EBK JAVA PROGRAMMING
EBK JAVA PROGRAMMING
Computer Science
ISBN:
9781337671385
Author:
FARRELL
Publisher:
CENGAGE LEARNING - CONSIGNMENT
Programming Logic & Design Comprehensive
Programming Logic & Design Comprehensive
Computer Science
ISBN:
9781337669405
Author:
FARRELL
Publisher:
Cengage