Question: Implement the following Edit Operations insert delete find getCursor - get the current row and col of the cursor position moveCursor - place the cursor
Implement the following Edit Operations
insert
delete
find
getCursor get the current row and col of the cursor position
moveCursor place the cursor at the given row and col
replace
im getting these errors:
LAST RUN on :: PM
error: "Pre command failed:
MyImplementationsMyArrayListjava:: error: MyArrayList is not abstract and does not override abstract method setintE in MyList
public class MyArrayList implements MyList
where E is a typevariable:
E extends Object declared in class MyArrayList
MyImplementationsTestMyStringjava:: error: cannot find symbol
System.out.printlns indexOf o is sindexOfo;
symbol: method indexOfchar
location: variable s of type MyString
MyImplementationsTestMyStringjava:: error: cannot find symbol
System.out.printlns indexOf o J is sindexOfo J;
symbol: method indexOfString
location: variable s of type MyString
MyImplementationsTestMyStringjava:: error: cannot find symbol
System.out.printlns replace m with $ is sreplacem$;
symbol: method replacecharchar
location: variable s of type MyString
MyImplementationsTestMyStringjava:: error: cannot find symbol
System.out.printlns replace o Java with o C# is sreplaceo Javao C#;
symbol: method replaceStringString
location: variable s of type MyString
MyImplementationsTestMyStringjava:: error: cannot find symbol
System.out.printlns count o is scounto;
symbol: method countchar
location: variable s of type MyString
MyImplementationsTestMyStringjav
public class MyString
private char chars;
public MyStringchar chars
this.chars chars.clone;
public MyStringString s
thisstoCharArray;
public int length
return chars.length;
public char charAtint index
if index index chars.length throw new IndexOutOfBoundsException;
return charsindex;
public MyString substringint begin, int end
if begin end chars.length begin end throw new IndexOutOfBoundsException
char subChars new charend begin;
System.arraycopychars begin, subChars, end begin;
return new MyStringsubChars;
public MyString concatMyString s
char result new charcharslength slength;
System.arraycopychars result, chars.length;
System.arraycopyschars, result, chars.length, slength;
return new MyStringresult;
public String toString
return new Stringchars;
size
Aa ab of
package MyImplementations;
public class MyStack
private MyArrayList list new MyArrayList;
public boolean isEmpty
return list.size;
public void pushE e
list.addlistsize e;
public E pop
if isEmpty throw new IllegalStateExceptionStack is empty";
return list.removelistsize;
public E peek
if isEmpty throw new IllegalStateExceptionStack is empty";
return list.getlistsize;
public int getSize
return list.size;
@Override
public String toString
return "Stack: list.toString;
package MyImplementations;
public class MyArrayList implements MyList
public static final int INITIALCAPACITY ;
@SuppressWarningsunchecked
private E data E new ObjectINITIALCAPACITY;
private int size ;
public MyArrayList
@SuppressWarningsunchecked
public MyArrayListint capacity
data E new Objectcapacity;
public MyArrayListE objects
for E obj : objects
addsize obj;
@Override
public void addint index, E e
if index index size throw new IndexOutOfBoundsException;
ensureCapacity;
for int i size ; i index; i
datai datai;
dataindex e;
size;
private void ensureCapacity
if size data.length
@SuppressWarningsunchecked
E newData E new Objectdatalength ;
System.arraycopydata newData, size;
data newData;
@Override
public E getint index
if index index size throw new IndexOutOfBoundsException;
return dataindex;
@Override
public int indexOfObject e
for int i ; i size; i
if e null datai null : eequalsdatai return i;
return ;
@Override
public int lastIndexOfE e
for int i size ; i ; i
if e null datai null : eequalsdatai return i;
return ;
@Override
public E removeint index
if index index size throw new IndexOutOfBoundsException;
E removed dataindex;
for int i index; i size ; i
datai datai ;
datasize null;
size;
return removed;
@Override
public E setint index, E e
if index index size throw new IndexOutOfBoundsException;
E old dataindex;
dataindex e;
return old;
@Override
public int size
return size;
@Override
public void
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
