Question: CSE 110: Principles of Programming Languages Assignment 7 Overvievw In this assignment you will write a program that will implement your own version of String.

 CSE 110: Principles of Programming Languages Assignment 7 Overvievw In this

assignment you will write a program that will implement your own version

of String. Your class will be based around a character array. You

CSE 110: Principles of Programming Languages Assignment 7 Overvievw In this assignment you will write a program that will implement your own version of String. Your class will be based around a character array. You will write several methods that mimic String methods and then perform searches within the String, similar to the ones from Assignment Note: You do not have to worry about multiple occurrences of something you are searching for or blank Strings. Requirements Your program must do the following in order to receive full credit on this assignment. 1. Create a class called MyString 2. Make two private instance variables for MyString a. An int, which is the length of the String b. A char array, which is the characters in the String 3. Create a default constructor for MyString which sets the length of the array to C 4. Create a regular constructor which takes a single String parameter and sets this MyString object to be that String This means that the array should be as long as the parameter and each element in the array is one character from the parameter a. 5. Create an boolean method called equals that accepts a String parameter and returns true if the contents of the parameter match the contents of the array a. This should function identically to the equals method from String. b. Hint: Don't forget that String has a toCharArray method and a charAt method. 6. Create an int method called indexOf which takes a char argument and returns the index of the first occurrence of that char in the array a. Again, you do not have to worry about multiple occurrences. b. This should return -1 if the char was not found 7. Overload the indexOf method to create a version which takes a String parameter and retums the index of the start position of the parameter in the char array a. Again, return -1 if it is not in the array b. The whole parameter must be in the array, in order, for this to return an index. i. See Example Outputs

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!