What you need to do: Write and test the method public static String capitalize (String str)...
Fantastic news! We've Found the answer you've been seeking!
Question:
Transcribed Image Text:
What you need to do: Write and test the method public static String capitalize (String str) which takes a string argument and returns a new String consisting of str, with the first character in uppercase and all the remaining characters in lowercase. Non-letter characters are unaffected. Here are some examples: str "bobby" "ILENE" "YOU-tubER" "133t haXXor" "3-Point shot" value returned by capitalize (str) "Bobby" "Ilene" "You-tuber" "L33t haxxor" "3-point shot" Once again, this method is somewhat easier to write if you use the substring method, but can be accomplished (a bit more awkwardly, I'll admit) by using a combination of a for loop, the toCharArray, charAt, toUpperCase, toLowerCase, and String constructor methods. What you need to do: Write and test the method public static String capitalize (String str) which takes a string argument and returns a new String consisting of str, with the first character in uppercase and all the remaining characters in lowercase. Non-letter characters are unaffected. Here are some examples: str "bobby" "ILENE" "YOU-tubER" "133t haXXor" "3-Point shot" value returned by capitalize (str) "Bobby" "Ilene" "You-tuber" "L33t haxxor" "3-point shot" Once again, this method is somewhat easier to write if you use the substring method, but can be accomplished (a bit more awkwardly, I'll admit) by using a combination of a for loop, the toCharArray, charAt, toUpperCase, toLowerCase, and String constructor methods.
Expert Answer:
Answer rating: 100% (QA)
Heres the implementation of the capitalize method in Java that capitalizes the first character of a string and converts the remaining characters to lo... View the full answer
Related Book For
Modern Database Management
ISBN: 978-0133544619
12th edition
Authors: Jeff Hoffer, Ramesh Venkataraman, Heikki Topi
Posted Date:
Students also viewed these programming questions
-
The probability model below describes the number of repair calls that an appliance repair shop may receive during an hour. Complete parts a and b below. Repair Calls Probability 1 2 3 4 0.2 0.4 0.2...
-
A regular language is a language that can be defined by a regular expression. 0 2 . 1 Complete the unshaded cells of Table 1 to show which of the statements about regular languages are true and which...
-
C++ Very Important to Read: For program 2 you will be using a string class to read from a file, sort and then output some string . I will give you most of the code for the string class called...
-
Which one of the following results from the latest decision round are least important in providing guidance to company managers in making their strategic moves and decisions to improve their...
-
(a) What is meant by the term system in thermodynamics? (b) What is a closed system? (c) What do we call the part of the universe that is not part of the system?
-
If you are offered two investments, one that pays 5% simple interest per year and one that pays 5% compound interest per year, which would you choose? Why?
-
The Tramot Corporation has $2,000,000 of 6 percent bonds outstanding. There is $40,000 of unamortized discount remaining on the bonds after the March 1, 20x6, semiannual interest payment. The bonds...
-
Determining the internal rate of return Irving Manufacturing Company has an opportunity to purchase some technologically advanced equipment that will reduce the companys cash outflow for operating...
-
Following the steps below, use logarithmic differentiation to determine the derivative of the function f(x)= (1+2x)1/x sin(x) a. Take the natural log of both sides and use properties of logarithms to...
-
1. a. How much did the materials cost per unit change between June and July? b. How much did the conversion cost per unit change between June and July? 2. Which is the optimal choice of material and...
-
QUESTION 1 Silver Tech Bhd is a local manufacturing company specialising in computer and technical services. The company was listed in Bursa Malaysia since 2010 with 45,000,000 units of ordinary...
-
modify the following code to count the number of repeating each array element and to check it modifying in an array inside the function the changes will reflect the original copy?: #include using...
-
Playful Kids company Manufactures several Toys .The following Average Revenue and Cost of Sales are as follows: Selling price per unit $20 Variable cost per unit: Direct Materials $4.00 Direct...
-
The solution set for 6a - a-5 = 0 is
-
If f(x) sin(x), find f'(x). f'(x) = =
-
provide a concluding statement into where the brands strength and weakness sit in the relation to brand identity and offer three suggestion to improve brand identity. refrence to CADBURY COMPANY.
-
4 A company had a tractor destroyed by fire. The tractor originally cost $129,000 with accumulated depreciation of $63,600. The proceeds from the insurance company were $24,000. The company should...
-
Determine the annual percentage yield for a loan that charges a monthly interest rate of 1.5% and compounds the interest monthly.
-
Continuation of S10-5: cash budget (Learning Objective 3) Refer to S10-5. Grippers has $8,300 cash on hand on January 1. The company requires a minimum cash balance of $7,500. January cash...
-
Revise cash payments for purchases (Learning Objective 4) Refer to the original Whitewater Sporting Goods Data Set item 5. Suppose Whitewater Sporting Goods pays for 60% of inventory purchases in the...
-
Revise cash collections budget (Learning Objective 4) Turn to the original Whitewater Sporting Goods Data Set item 4. Suppose 70% of sales are cash and 30% are credit. Revise Whitewater's sales...
Study smarter with the SolutionInn App