![]() |
|
|
|||||||
![]() |
General Help Related Topics - Java String Problems |
|
|
Thread Tools | Search this Thread |
|
|
#1 |
|
Can anyone help me? I am a beginning Java programmer, and I can't figure out how to do the following.:
Write a program names L5GetName where the user enters a String. The string contains the users first name and last name separated by one of more spaces. Output the name as last name, first name. Capitalize the first letter of each name. The following is sample output that you can use to test your program. Note the case that should detect an error. Input Output john doe Doe, John mary Lamb Lamb, Mary bob Error: must have first and last name BOB HOPE Hope, Bob mary lamb Lamb, Mary Note: Your program should be in a loop so that when the user clicks cancel, the program exits. It exits the loop when IO.inputString() returns a null. Note: Make sure to include your name, date, purpose of the program, and the name of the source file as comments at the top. Hint: For this lab, use of the following string methods is sufficient: equals, substring, indexOf, length, toUpperCase, toLowerCase, trim and string concatenation. Write a program named L5GetString that accepts a string and outputs: a. The string b. Count the number of vowels in the string c. The offset to the first occurrence of a vowel d. A string that replaces all occurrences of the first letter of the input string by the second letter of that string. Note: Like the previous example, exit the program when the user clicks cancel while entering the string. Include your name, date, and name of the source file as comments at the top. Hint: For this lab, use of the following string methods is sufficient: charAt, indexOf, length. Sample input and output The string is abracadabra Count of vowels is 5 Index of first vowels is 0 The replacement string is bbrbcbdbbrb The string is sississippi Count of vowels is 4 Index of first vowels is 1 The replacement string is iiiiiiiippi Thanks, Bobby rbnbenjamin |
|
|
|
|
![]() |
| Thread Tools | Search this Thread |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Give you enough string functions in Java web reporting tool | freezea | Software | 0 | 10-08-2009 09:03 AM |
| ASP.NET: Asign Users in Roles(Array.IndexOf(Of String) method) | msandlana | Software | 0 | 04-25-2008 06:37 AM |
| Hidden linebreaks in string? VB.NET | Jiggy | Software | 0 | 04-23-2008 02:18 PM |
| Re: Pioneer DVR-105 and Nero Problems | grams@oldtown.com | DVD Video | 1 | 08-12-2003 04:17 AM |
| Re: Pioneer DVR-105 and Nero Problems | Ron | DVD Video | 1 | 08-08-2003 06:33 PM |