In this assignment, you will implement a simple class called CustomString. This class represents a more customizable version of a String, with additional attributes and methods. For example, the CustomString class has a "reverse" method which returns a new string version of the current string where the capitalization is reversed (ie, lowercase to uppercase and uppercase to lowercase) for the alphabetical characters specified in a given argument. For CustomString "abc., XYZ: 123.", calling reverse("bcdxyz@3210.") will return "aBC, xyz: 123.". The CustomString class also has a "remove" method which returns a new string version of the current string where the alphabetical characters specified in a given argument, are removed. For CustomString "my lucky numbers are 6, 8, and 19.". calling remove("ra6") will return "my lucky numbers e 6, 8, nd 19.". There are 5 methods that need to be implemented in the CustomString class: getString) - Returns the current string setString(String string) - Sets the value of the current string. remove(String arg) - Returns a new string version of the current string where the alphabetical characters specified in the given arg, are removed. • reverse(String arg) - Returns a new string version of the current string where the capitalization is reversed (i.e., lowercase to uppercase, and uppercase to lowercase) for the alphabetical characters specified in the given arg. • filterLetters(char n, boolean more) - Returns a new string version of the current string where all the letters either >= or cs the given char n, are removed.
In this assignment, you will implement a simple class called CustomString. This class represents a more customizable version of a String, with additional attributes and methods. For example, the CustomString class has a "reverse" method which returns a new string version of the current string where the capitalization is reversed (ie, lowercase to uppercase and uppercase to lowercase) for the alphabetical characters specified in a given argument. For CustomString "abc., XYZ: 123.", calling reverse("bcdxyz@3210.") will return "aBC, xyz: 123.". The CustomString class also has a "remove" method which returns a new string version of the current string where the alphabetical characters specified in a given argument, are removed. For CustomString "my lucky numbers are 6, 8, and 19.". calling remove("ra6") will return "my lucky numbers e 6, 8, nd 19.". There are 5 methods that need to be implemented in the CustomString class: getString) - Returns the current string setString(String string) - Sets the value of the current string. remove(String arg) - Returns a new string version of the current string where the alphabetical characters specified in the given arg, are removed. • reverse(String arg) - Returns a new string version of the current string where the capitalization is reversed (i.e., lowercase to uppercase, and uppercase to lowercase) for the alphabetical characters specified in the given arg. • filterLetters(char n, boolean more) - Returns a new string version of the current string where all the letters either >= or cs the given char n, are removed.
Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
Related questions
Question
Please Use Java only.
In this assignment, you will implement a simple class called CustomString. This class represents a more customizable version of a String, with additional attributes and methods.
For example, the CustomString class has a “reverse” method which returns a new string version of the current string where the capitalization is reversed (i.e., lowercase to uppercase and uppercase to lowercase) for the alphabetical characters specified in a given argument. For CustomString “abc, XYZ; 123.”, calling reverse("bcdxyz@3210.") will return "aBC, xyz; 123.".
The CustomString class also has a “remove” method which returns a new string version of the current string where the alphabetical characters specified in a given argument, are removed. For CustomString "my lucky numbers are 6, 8, and 19.", calling remove("ra6") will return "my lucky numbers e 6, 8, nd 19.".
There are 5 methods that need to be implemented in the CustomString class:
● getString() - Returns the current string.
● setString(String string) - Sets the value of the current string.
● remove(String arg) - Returns a new string version of the current string where the
alphabetical characters specified in the given arg, are removed.
● reverse(String arg) - Returns a new string version of the current string where the
capitalization is reversed (i.e., lowercase to uppercase, and uppercase to lowercase) for
the alphabetical characters specified in the given arg.
● filterLetters(char n, boolean more) - Returns a new string version of the current string
where all the letters either >= or
operators.
For example:
char myChar1 = ‘s’; char myChar2 = ‘t’;
//compared is true
boolean compared = myChar1 < myChar2;

Transcribed Image Text:The Assignment
In this assignment, you will implement a simple class called CustomString. This class
represents a more customizable version of a String, with additional attributes and methods.
For example, the CustomString class has a "reverse" method which returns a new string
version of the current string where the capitalization is reversed (i.e., lowercase to uppercase
and uppercase to lowercase) for the alphabetical characters specified in a given argument For
CustomString "abc, XYZ; 123.", calling reverse("bcdxyz@3210.") will return "aBC, xyz: 123.".
The CustomString class also has a "remove" method which returns a new string version of the
current string where the alphabetical characters specified in a given argument, are removed.
For CustomString "my lucky numbers are 6, 8, and 19.", calling remove("ra6") will return "my
lucky numbers e 6, 8, nd 19.",
There are 5 methods that need to be implemented in the CustomString class:
getString() - Returns the current string.
• setString(String string) - Sets the value of the current string.
• remove(String arg) - Returns a new string version of the current string where the
alphabetical characters specified in the given arg, are removed.
• reverse(String arg) - Returns a new string version of the current string where the
capitalization is reversed (i.e., lowercase to uppercase, and uppercase to lowercase) for
the alphabetical characters specified in the given arg.
• filterLetters(char n, boolean more) - Returns a new string version of the current string
where all the letters either >= or <= the given char n, are removed.
Penn
Engineering
TONLINE LEARNING
Introduction to Java & Object Oriented Programming
Each method has been defined for you, but without the code. See the javadoc for each method
for instructions on what the method is supposed to do and how to write the code. It should be
clear enough. In some cases, we have provided hints and example method calls to help you
get started.
For example, we have defined a "setString" method for you (see below) which sets the value of
the current string. Read the javadoc, which explains what the method is supposed to do. Then
write your code where it says "II TODO" to implement the method. You'll do this for each
method in the program.
/**
* Sets the value of the current string.
* eparam string value to be set
public void setString (String string) {
// TODO Implement method
In addition, you will write unit tests to test your method implementations. Each unit test
method has been defined for you, including some test cases. First make sure you pass all of
the provided tests, then write additional and distinct test cases for each unit test method.
For example, we have defined a "testSetString" method for you (see below) which tests the
"setString" method. Pass the tests provided then write additional tests where it says "I
TODO". You'll do this for each unit test method in the program.
@Test
void testSetString () (
//string should be null to start, before setting it
assertNull (this.myCustomstring.getString ()):
this.myCustomString.setString ("Good-bye!"):
assertEquals ("Good-bye!", this.myCustomstring.getString ());
// TODO write at least 3 additional test cases
Tips for this Assignment
In this assignment, some tips are given as follows:
APenn
Engineering
![Tips for this Assignment
In this assignment, some tips are given as follows:
Penn
Engineering
ONLINE LEARNING
Introduction to Java & Object Oriented Programming
Converting a String to an array of chars in Java:
o Use the "toCharArray()" method of a String
For example:
String myString = "hello";
//arrayofChars contains 'h', 'e', 'l', 'l', 'o'
Char[] arrayOfChars = myString.toCharArray();
Checking whether a specified char value is a letter in Java:
o Use "Character.isLetter(char)"
For example:
//isLetter is true
boolean isLetter = Character.isLetter ('t');
Checking whether a specified char value is uppercase in Java:
o Use "Character.isUpperCase(char)"
For example:
//isUpperCase is true
boolean isUpperCase = Character.isUpperCase ('T');
Checking whether a specified char value is lowercase in Java:
o Use "Character.isLowerCase(char)"
For example:
//isLowerCase is true
boolean isLowerCase = Character.isLowerCase ('t');
Converting a character to uppercase in Java:
o Use "Character.toUpperCase(char)"
For example:
//myChar is 'T'
char myChar
Converting a character to lowercase in Java:
haracter.toUpperCase ('t');
Use "Character.toLowerCase(char)"
For example:
//myChar is t'
char myChar = Character.toLowerCase ('T');
Comparing characters in Java:
You can compare characters like you compare numbers using ==, <, and >
operators.
For example:
's' ;
char myCharl =
char myChar2 =
't';
//compared is true
boolean compared = myCharl < myChar2;](/v2/_next/image?url=https%3A%2F%2Fcontent.bartleby.com%2Fqna-images%2Fquestion%2Fa4946c40-85e7-4bdb-afce-1b8e9a9b2811%2F4d611ee7-26b2-4fa1-8693-bef4b16453cc%2Fv4dbwvb_processed.jpeg&w=3840&q=75)
Transcribed Image Text:Tips for this Assignment
In this assignment, some tips are given as follows:
Penn
Engineering
ONLINE LEARNING
Introduction to Java & Object Oriented Programming
Converting a String to an array of chars in Java:
o Use the "toCharArray()" method of a String
For example:
String myString = "hello";
//arrayofChars contains 'h', 'e', 'l', 'l', 'o'
Char[] arrayOfChars = myString.toCharArray();
Checking whether a specified char value is a letter in Java:
o Use "Character.isLetter(char)"
For example:
//isLetter is true
boolean isLetter = Character.isLetter ('t');
Checking whether a specified char value is uppercase in Java:
o Use "Character.isUpperCase(char)"
For example:
//isUpperCase is true
boolean isUpperCase = Character.isUpperCase ('T');
Checking whether a specified char value is lowercase in Java:
o Use "Character.isLowerCase(char)"
For example:
//isLowerCase is true
boolean isLowerCase = Character.isLowerCase ('t');
Converting a character to uppercase in Java:
o Use "Character.toUpperCase(char)"
For example:
//myChar is 'T'
char myChar
Converting a character to lowercase in Java:
haracter.toUpperCase ('t');
Use "Character.toLowerCase(char)"
For example:
//myChar is t'
char myChar = Character.toLowerCase ('T');
Comparing characters in Java:
You can compare characters like you compare numbers using ==, <, and >
operators.
For example:
's' ;
char myCharl =
char myChar2 =
't';
//compared is true
boolean compared = myCharl < myChar2;
Expert Solution

This question has been solved!
Explore an expertly crafted, step-by-step solution for a thorough understanding of key concepts.
This is a popular solution!
Trending now
This is a popular solution!
Step by step
Solved in 7 steps

Knowledge Booster
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.Recommended textbooks for you

Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education

Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON

Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON

Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education

Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON

Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON

C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON

Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning

Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education