Question: Your overall task for Part B is to read in a string from the console, convert it into an instance of MyString implemented now as
Your overall task for Part B is to read in a string from the console, convert it into an instance of MyString
implemented now as a singly linked list of characters, and reimplement a subset of the standard string
operations.
Requirements
Complete the MyString class that is partially defined below.
public class MyString : ICloneable, IComparable
private class Node
public char item;
public Node next;
Constructor mark
public Node
private Node front; Reference to the first header node
private int length; Number of characters
Initialize an instance of MyString based on the given character array A marks
public MyString char A
Create and return a clone of the current instance marks
public object Clone
Compare the current instance of MyString with obj and return a or
if the current string comes before, at or after obj in alphabetical order marks
public int CompareToobject obj
Return the index of the first occurrence of c; otherwise return marks
public int IndexOfchar c
Remove all occurrences of c marks
public void Remove char c
Return true if obj is both of type MyString and the same as the current instance;
otherwise return false marks
Hint: Use CompareTo
public override bool Equals object obj
Print the current instance of MyString marks
public void Print
The main program will present a list of options to the user that exercises each of the methods above. To
display and allow the user to choose among multiple instances of MyString, store the instances of
MyString in an instance of List. For a bonus marks, keep the list in alphabetical order.
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
