Project 10 MyString Class solved




Purpose: The purpose for this project is to reinforce the knowledge from Chapter 10 of the textbook.
The students will learn how to write a user defined class.
Project Objectives:
1. Apply UML design on user defined class
2. Write overloaded constructors of a class
3. Write customer methods of the class (Other than get and set methods)
Problem description:
The String class is provided by java library. Write your own String class based on the following UML
diagram. No built-in String, StringBuffer related classes are allowed.
-data: char[]
+MyString(chars: char[])
+charAt(i: int) : char
+length() : int
+substring(begin: int, end: int) : MyString
+toLowerCase() : MyString
+equals(other: MyString) : Boolean
+valueOf(i: int) : MyString
All methods have the same functionality as the corresponding methods in String class. You shall provide
a main function to test all methods in MyString class.
Due date will be announced on Blackboard.