Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Create a program, StringRegexLab.java, which will complete the following. Submit on the cs server the java file. 1st Problem: 1. State to the screen how

image text in transcribed

Create a program, StringRegexLab.java, which will complete the following. Submit on the cs server the java file. 1st Problem: 1. State to the screen how many constructors there are for the String class. 2. State to the screen whether the String class is mutable or immutable. If it is immutable, state what is returned each time a method that changes the String is invoked in the String class. 3. State to the screen the difference between a literal String (interned string) and a String object. 4. Create a String object with the value CSC 202 and print it to the screen. 5. Invoke the toString method on the variable from #4, display the returned value to the screen. 6. Create an interned string/String literal with the value of CSC 202 and print it to the screen. 7. Invoke the toString method on the variable from #6, display the returned value to the screen. 8. Create a String array with the value: 102,202,211,214,302,323 using the comma as the split method argument. 9. Print the array to the screen. 2nd Problem: write an app that eliminates the typing error of having extra white space around a word and the error of inserting an extra space within a word Procedure: read in a word, utilize a method that removes the extra spaces around the word, then check to see if there are spaces with the word and eliminate those (fyi: \s is the code for a space) 3rd Problem: write an app to shorten text messages that are over 10 characters long. When a message is over 10 characters, following rules will work to shorten the messages: 1. eliminate vowels, unless a word starts with a vowel 2. eliminate repeated letters in a word Show how many character have been eliminated with your app. Procedure: read in a line of text as one String, convert it to lowercase letters, and check the length; when it is over 10 characters get a character i by 1 (you might need an extra variable to help you with this) and ignore the 1s character of a word if it is a vowel if the character is a vowel and not the 1s character, do not use the character and increment the value that is counting the replacements if the character is a repeating character, do not use the character and increment the value that is counting the replacements Create a program, StringRegexLab.java, which will complete the following. Submit on the cs server the java file. 1st Problem: 1. State to the screen how many constructors there are for the String class. 2. State to the screen whether the String class is mutable or immutable. If it is immutable, state what is returned each time a method that changes the String is invoked in the String class. 3. State to the screen the difference between a literal String (interned string) and a String object. 4. Create a String object with the value CSC 202 and print it to the screen. 5. Invoke the toString method on the variable from #4, display the returned value to the screen. 6. Create an interned string/String literal with the value of CSC 202 and print it to the screen. 7. Invoke the toString method on the variable from #6, display the returned value to the screen. 8. Create a String array with the value: 102,202,211,214,302,323 using the comma as the split method argument. 9. Print the array to the screen. 2nd Problem: write an app that eliminates the typing error of having extra white space around a word and the error of inserting an extra space within a word Procedure: read in a word, utilize a method that removes the extra spaces around the word, then check to see if there are spaces with the word and eliminate those (fyi: \s is the code for a space) 3rd Problem: write an app to shorten text messages that are over 10 characters long. When a message is over 10 characters, following rules will work to shorten the messages: 1. eliminate vowels, unless a word starts with a vowel 2. eliminate repeated letters in a word Show how many character have been eliminated with your app. Procedure: read in a line of text as one String, convert it to lowercase letters, and check the length; when it is over 10 characters get a character i by 1 (you might need an extra variable to help you with this) and ignore the 1s character of a word if it is a vowel if the character is a vowel and not the 1s character, do not use the character and increment the value that is counting the replacements if the character is a repeating character, do not use the character and increment the value that is counting the replacements

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

Database Security

Authors: Alfred Basta, Melissa Zgola

1st Edition

1435453905, 978-1435453906

More Books

Students also viewed these Databases questions

Question

=+employee to take on the international assignment?

Answered: 1 week ago

Question

=+differences in home- and host-country costs of living?

Answered: 1 week ago