Question
Can I get some assistance with the following Java project. I am attaching two pictures. One is of the requirement and the second is of
Can I get some assistance with the following Java project. I am attaching two pictures. One is of the requirement and the second is of netbeans with the java classes i am using.
This is the code I need to make work based on the attached requirements:
LinkedString(char[] value)
//Allocates a new character linked list so that it represents the sequence of characters currently
contained in the character array argument.
LinkedString(String original)
//Initializes a new character linked list so that it represents the same sequence of characters as
the argument.
Char charAt(int index)
//Returns the character value at the specified index. The first character in the linked character
string is in position zero.
LinkedString concat(LinkedStringstr)
//Concatenates the specified linked character string to the end of this linked character string.
Boolean isEmpty()
//Returns true if, and only if length() is 0.
Int length()
//Returns the length of this linked character string.
LinkedString substring(int beginIndex, int endIndex)
//Returns a new linked character string that is a substring of this linked character string
Here is the code and its giving me errors. Do i need to create the LinklStringTest class and node class first before it would work?(From netbean picture)
public class LinkedString {
LinkedList string; int numberOfChars;
LinkedString(char[] value) { numberOfChars = 0; string = new LinkedList(); for (char c : value) { string.add(Character.valueOf(c)); numberOfChars++; } }
LinkedString(String Original) { numberOfChars = 0; string = new LinkedList(); for (int i = 0; i
char charAt(int index) { return (string.get(index).charValue()); }
LinkedString concat(LinkedString str) { for (int i = 0; i
boolean isEmpty() { if (this.length() == 0) { return true; } return false; }
int length() { return this.numberOfChars; }
LinkedString substring(int beginIndex, int endIndex) { String tmp = ""; Iterator it = string.listIterator(beginIndex); int count = beginIndex; while (count
Please advise where I am making the mistake.
(On page 308) Implement the ADT character string as the class Linkedstring by using a linked list of characters. Include the following LinkedString constructors and methods LinkedString (char [ value) llocates a new character linked list so that it represents the sequence of characters currently contained in the character array argument Linkedstring(String original) Initializes a new character linked list so that it represents the same sequence of characters as the argument char charAt (int index) Returns the char value at the specified index. The first character in the linked character string is in position zero LinkedString concat (LinkedString str) Concatenates the specified linked character string to the end of this linked character string boolean isEmpty () Returns true if, and only if, length() is 0 int length () Returns the length of this linked character string Linkedstring substring(int beginIndex, int endIndex) Returns a new linked character string that is a substring of this linked character string Implement LinkedString so that it mimics the Java String class. For example, character positions should start at zero. Also, keep track of the number of characters in the string; the length should be determined without traversing the linked list and counting, a variable should be used for this purpose Iso remember to include a test (client/driver) program which creates at least two objects from your LinkedString class and invokes all of the LinkedString methods you have written. File Edit ew Navigate Source Refactor Run Dehug Profile Team Iaals Windaw Help Search default config> Prajerts Services Project1 Start Page dunkedsuri najava x 4 LinkedStringTestjava Kres NodeJava Saurce Packages * Programmer: Ivan Flores * Description: Implement the ADT on page 388 LinkedString using a linked list default package: LinkedString java 4 of characters. Also inicude test client/driver) program to create at least two objects t from my LinkedString Class and invake aTI of the LinkedString methods written Nade.java Test Packages Libraries Test Libraries 9 public class LinkedString f LinkedListStep 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