Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

design a new \"String\" class which holds a character string as a linked list of

ID: 3529141 • Letter: D

Question

design a new "String" class which holds a character string as a linked list of characters. Each node in the linked list has a single character as its data. The class must include the following methods in addition to those you think may also be needed in this program: - 2 constructors: a default which builds a string from a text file or keyboard; the other takes in a string through a parameter - 2 search methods: one starts search for a key (also a "string") from left end of a string; the other starts search from any point (passed in as a parameter) of a string - charAt: accesses a character in a string - 2 substring methods: one uses one parameter as the start point; the other specifies start and end points - insert: allows a string to be inserted to any point of an original string - toString You will then design a "Number" class which can hold a number of any length using the new String class. Numbers of any length can be entered, added and subtracted and output using the class. Design a MainClass to test all the required operations in both classes.

Explanation / Answer

Introduction The new string class differs from the old string class in how strings are copied. The reason for this change is to make the behaviour of the string class more like the behaviour of Java's string class. Behaviour of the earlier C++ string class: String s = "abc"; String t = s; t