Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Within a class named LX4, write methods as follows: 1. a method named valueCheck that accepts a parameter int named value and, using a switch

Within a class named LX4, write methods as follows:

1. a method named valueCheck that accepts a parameter int named value and, using a switch statement, displays text output as follows:

if value is 4 or greater: "LOTS"

if value equals 3: "three"

if value equals 2: "two"

if value equals 1: "one"

if value equals 0: "zero"

if value is negative: "NEGATIVE"

2. a method named textMatch that accepts two parameter String objects named string1 and string2 and returns true if their text is identical and false otherwise

3. a method named sameObject that accepts two Objects as parameters and returns true if they are the same object and false otherwise (note that the Object class does not require any import statement)

4. a method named factorCheck that accepts a parameter int named value and returns values as follows:

if value is greater than 49 or less than 1, return -1

if value equals 1, return 0

if value is evenly divisible by 7, return 7

if value is evenly divisible by 5, return 5

if value is evenly divisible by 3, return 3

if value is evenly divisible by 2, return 2

if none of the above are true, return 1

5. Write an equivalent version of String's indexOf() method. The method will accept as parameters two Strings, big and small. If the same text of small is contained in big, the method will return the index of the first character of small from its first appearance in big.

6. Write an extended version of String's indexOf() method. The method will accept as parameters two Strings, big and small, and two ints, start and end. Like 3) above, this method will search big for matching text with the String small and return the index of the first character of small from its first appearance in big. However, in this case the search will cover not the entire String big but the match must begin at or after index start and end at or before index end.

* Java *

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Advanced Database Systems

Authors: Carlo Zaniolo, Stefano Ceri, Christos Faloutsos, Richard T. Snodgrass, V.S. Subrahmanian, Roberto Zicari

1st Edition

155860443X, 978-1558604438

More Books

Students also viewed these Databases questions

Question

1.The difference between climate and weather?

Answered: 1 week ago

Question

1. What is Fog ?

Answered: 1 week ago

Question

How water vapour forms ?

Answered: 1 week ago

Question

What is Entrepreneur?

Answered: 1 week ago

Question

Which period is known as the chalolithic age ?

Answered: 1 week ago