Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Class StringImproved public class StringImproved extends java.lang.Object This program replaces the string class with a mutable string. This class represents a character array and provide

Class StringImproved

public class StringImproved extends java.lang.Object

This program replaces the string class with a mutable string.

This class represents a character array and provide functionalities need to do basic string processing. It contains an array of characters, representing a textual string.

Overview

In Java, Strings are a great device for storing arrays of characters. One limitation of Strings in Java, however (there is always at least one), is that they are immutable (ie. they cannot be changed once created). Your mission is to create a mutable String Class (called StringImproved) with some clever features. You will also need to ensure that your program is bug free. Your StringImproved Class should be uncrashable as possible. If your code detects faulty/incorrect input it should handle it as instructed in this java API

Data Structure

To make your life easier you will be provided with an API specification (just like the JavaDocs you use for your programming). You must use a char array to store your String in your Class. You are not permitted to use any collection Classes in this assignment. You will need to implement the entire class based on the API specification. This class will encapsulate all the functionality required.

Testing

A test program is also provided for you to use. Please read it carefully as you will be expected to generate your own in assignment 2. Use the test driver as a starting point to test your Class as thoroughly as possible. Note that the marker reserves the right to test more conditions if they think of them.

How to Do The Assignment

I suggest you do your assignment in the following order

Create all the method signatures in the StringImproved Class. Each method should just be blank (with a return null or -1 if necessary).

Compile and make sure that the program works (well, technically it won't because the methods are empty, but make sure it compiles with no error).

Write the constructors. Test.

Write the length method. Test.

Write the charAt method. Test.

Write the endsWith method. Test.

Write the toLowerCase method. Test.

Write the toUpperCase method. Test.

Write the lastIndexOf method. Test.

Write the increaseArray method. Test (note there is no provided test you will need to do it). Write the shrinkArray method. Test (note there is no provided test you will need to do it). Write the contains method. Test.

Write the substring method. Test.

Write the insert method. Test.

Write the append method. Test.

Write the deleteSubString int int method. Test.

Write the deleteSubString string method. Test.

Write the deleteCharAt method. Test. Write the prepend method. Test.

Write the replaceString method. Test.

Write the sort (advanced students) method. Test.

Note that when you add functionality you may have to add test scenarios to other test methods to ensure you have covered all the possibilities.

Additional Requirement.

In addition to what is above there are a number of requirements for this assignment. Most of these are to introduce interesting problems for you to solve and must be obeyed.

As you are programming you will also need to comment your code thoroughly in each of your methods.

Whenever you use a String class (for example passed as a parameter) you can only use the charAt() method of String to get content. Sorry we can't make this too easy. The char array in your structure must always have only the space that is required.

You are not permitted to use any String methods in this class. If you use a String method you will get zero for the offending method. There is one exception you are permitted to use the Strings toCharArray method

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Microsoft Visual Basic 2017 For Windows Web And Database Applications

Authors: Corinne Hoisington

1st Edition

1337102113, 978-1337102117

More Books

Students also viewed these Databases questions