Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

USING JAVA Consider the following methods: StringBuilder has a method append(). If we run: StringBuilder s = new StringBuilder(); s.append(abc); The text in the StringBuilder

USING JAVA

Consider the following methods:

StringBuilder has a method append(). If we run:

StringBuilder s = new StringBuilder();

s.append("abc");

The text in the StringBuilder is now "abc"

Character has static methods toUpperCase() and to LowerCase(), which convert characters to upper or lower case. If we run Character x = Character.toUpperCase('c');, x is 'C'.

Character also has a static isAlphabetic() method, which returns true if a character is an alphabetic character, otherwise returns false.

You will also need String's charAt() method, which returns the character at a given index in the String. For example, "Godzilla".charAt(1) returns 'o'.

Write an application as follows:

  • public static String getNonAlpha() takes a String as parameter, builds a StringBuilder consisting of only the nonalphabetic characters in the String, and returns a String based on the StringBuilder (eg, sb.toString())
  • public static String getUpper() takes a String, builds a StringBuilder of the upper case versions of all the alphabetic characters in the String, and returns a String based on the StringBuilder.
  • main() asks the user for input (using a Scanner) and prints the results of running the input String through each of these methods.

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 2008 Comprehensive Concepts And Techniques

Authors: Gary B. Shelly, Corinne Hoisington

1st Edition

1423927168, 978-1423927167

More Books

Students also viewed these Databases questions

Question

What does CIO stand for, and why has such a position been created?

Answered: 1 week ago

Question

3. Evaluate a Web-based training site.

Answered: 1 week ago