Answered step by step
Verified Expert Solution
Question
1 Approved Answer
I need it in java NOT C++ -126374768-1/courses/201 8Spring-T-CSE1 10-11 392-28 103/CSE%201 10%20Assignment%20796281 %29 pdf CSE 110: Principles of Programming Languages Assignment 7 Overview In
I need it in java NOT C++
-126374768-1/courses/201 8Spring-T-CSE1 10-11 392-28 103/CSE%201 10%20Assignment%20796281 %29 pdf CSE 110: Principles of Programming Languages Assignment 7 Overview 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 2. Note: You do not have to worry about multiple occurrences of something you are searching for or blank Strings. You may NOT convert your character array to a String at any time other than the toString method. It would defeat the entire purpose of writing your own version. 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 An int, which is the length of the String a. A char array, which is the characters in the String b. Create a default constructor for MyString which sets the length ofthe arac too Create a regular constructor which takes a single String parameter and sets this MyString object to be that String 3. 4. 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 toCharAay method and a char At 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 arra a. Again, you do not have to worry aboat multuple occurrences b. This should return-1 if the char was not lound
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started