IDS 201 Lab Exercise 5
Within a class named LX5, write methods as follows:
1. a method named valueCheck that accepts a parameterint named value and, using a switch statement, displaystext 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 parameterString objects named string1 and string2 andreturns true if their text is identical and false otherwise
3. a method named sameObject that accepts two Objectsas parameters and returns true if they are the same object andfalse otherwise (note that the Object class does not require anyimport statement)
4. a method named factorCheck that accepts a parameterint 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'sindexOf() method. The method will accept as parameters twoStrings, big and small. If the same text ofsmall is contained in big, the method will returnthe index of the first character of small from its firstappearance in big.
6. Write an extended version of String'sindexOf() method. The method will accept as parameters twoStrings, big and small, and two ints,start and end. Like 3) above, this method willsearch big for matching text with the Stringsmall and return the index of the first character ofsmall from its first appearance in big. However,in this case the search will cover not the entire Stringbig but the match must begin at or after indexstart and end at or before index end.