Question: Java problem. Write a program that manipulates two strings. The program inputs two strings (string1 and string2) and a character (char1) and an integer (position)
Java problem. Write a program that manipulates two strings. The program inputs two strings (string1 and string2) and a character (char1) and an integer (position) to represent a character position within a string. The program will display the following: 1. Whether string1 is less, greater or equal to string2 2. string1 in upper case 3. string2 in lower case 4. The number of characters in string1 5. The first character in string2 6. The number of occurrences that char1 is contained in string1. Hint: use a for loop and charAt 7. The character that is in the position of string1. Turn in a run of the program that uses your first and last names as the strings. Use at least two methods with the following headers: int countOccurrences(String s, char c) // to answer #6 char showChar(String s, int pos)// to answer #7
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
