
Database System Concepts
7th Edition
ISBN: 9780078022159
Author: Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher: McGraw-Hill Education
expand_more
expand_more
format_list_bulleted
Question

Transcribed Image Text:JAVA STRINGS
Let String 1 = "The quick brown fox jumps over the lazy dogs."
Let String 2 = "Mississippi"
Let String 3 = "Your Name" Enter your first and last name.
Let String 4 = "mississippi"
EXERCISES:
1) Write an appropriate java program that will:
a. Return the length of the 4 strings.
b. Compare String2 with String4 and determine if they are the same.
c. Compare String2 with String 4 ignoring case and determine if they are the sam
d. Convert Stings 1, 2, 3, and 4 to all upper case letters.
e. Convert Strings 1, 2, 3, and 4 to all lower case letters.
e.
2) Restore strings 1 to 4 to their original values. Find the character at index position 6 in
each string. (Put your guess first in the lines below and then check by writing the
appropriate Java code.)
Index position 6 for:
String 1:
String 3:
String 2:
String 4:
Determine what will be returned by charAt(3) and charAt(9) for each of the 4 Strings.
Write your answers first and then check by using the appropriate Java code.
charAt(3)
String1:
String2:_
String3:
String4:
charAt(9)
String1:
String2:
String3:
String4:
3) Use the appropriate method .concat(String s), create two new strings, String5 and String
6 that append String2 to String1 (for new String5) and and String4 to String 3. (New
String6) Show the results below.
String 5)_
String 6)_

Transcribed Image Text:4) Using the .replace(char oldChar, char newChar) method, replace every s character in
each of the strings with a z. Write the results below.
String1:
String3:
String2:_
String4:
5) Restore the strings one through 4 to their original values. Using the
substring(int start, int end) method, list the substrings returned for each of the four
strings if the values of (0, 4) and (3,8) are used. Write down what you think should
appear first and then check by programming the appropriate Java commands and check.
Substring (0,4)
String1:
String2:
String3:
String4:
Substring(3,8)
String1:
String2
String3:
String4:
Expert Solution

This question has been solved!
Explore an expertly crafted, step-by-step solution for a thorough understanding of key concepts.
This is a popular solution
Trending nowThis is a popular solution!
Step by stepSolved in 2 steps

Knowledge Booster
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.Similar questions
- Asaparrow_forwardRead a 2-character string from input into variable userString. Declare a Boolean variable isValid and assign isValid with true if userString does not contain any uppercase letters. Otherwise, assign isValid with false. Ex: If the input is 86, then isValid is assigned with true, so the output is: Good string Ex: If the input is BQ, then isValid is assigned with false, so the output is: Bad string Note: Use getline(cin, userString) to read the entire line from input into userString. #include <iostream>#include <string>#include <cctype>using namespace std; int main() { string userString; /* Your code goes here */ if (isValid) { cout << "Good string" << endl; } else { cout << "Bad string" << endl; } return 0;}arrow_forwardWrite a program that takes a capitalized character string (with letters ‘A’ through ‘Z’) and returns a lower-case character string. Begin with the values of r0 and r1 containing 0x46554C4C and 0x4D4F4F4E, which represent the ASCII characters of “FULL” and “MOON”, respectively. You should put the lower-case versions of these hexadecimal values in r2 and r3.arrow_forward
- Write a program to check a string has uppercase character or not. the string must take from user. JAVAarrow_forward3 – Write a python program that prompt the user to enter a string and count the number of words and characters in that string without using built-in methods.arrow_forwardIm stuck on this java code. The code is supposed to ask user for a string. Characters that are number, are doubled and replaced with the sum. The characters that are upper are replaced with lower and lower are replaced with upper. It should keep asking user for string until user input Q to end the program. example 1: original: 3rD converted: 6Rd ex 2: original: 6sJ converted: 3Sj (when a value is doubled and its than 9, the two digits are added. so 6 * 2 is 12. And then add the two digits. so 1 + 2 = 3.) I'm having problem with the code that its not reading where it replace the lower to upper and vice versa. this is my code so far: import java.util.Scanner;public class Convert {public static void main(String[] args) {Scanner input = new Scanner(System.in);String original, converted;while (true) {System.out.print("Original String (input):");original = input.nextLine();if (original.equals("q") || original.equals("Q")) {break;}char[] chars = original.toCharArray();for (int i = 0; i <…arrow_forward
arrow_back_ios
arrow_forward_ios
Recommended textbooks for you
- Database System ConceptsComputer ScienceISBN:9780078022159Author:Abraham Silberschatz Professor, Henry F. Korth, S. SudarshanPublisher:McGraw-Hill EducationStarting Out with Python (4th Edition)Computer ScienceISBN:9780134444321Author:Tony GaddisPublisher:PEARSONDigital Fundamentals (11th Edition)Computer ScienceISBN:9780132737968Author:Thomas L. FloydPublisher:PEARSON
- C How to Program (8th Edition)Computer ScienceISBN:9780133976892Author:Paul J. Deitel, Harvey DeitelPublisher:PEARSONDatabase Systems: Design, Implementation, & Manag...Computer ScienceISBN:9781337627900Author:Carlos Coronel, Steven MorrisPublisher:Cengage LearningProgrammable Logic ControllersComputer ScienceISBN:9780073373843Author:Frank D. PetruzellaPublisher:McGraw-Hill Education

Database System Concepts
Computer Science
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:McGraw-Hill Education

Starting Out with Python (4th Edition)
Computer Science
ISBN:9780134444321
Author:Tony Gaddis
Publisher:PEARSON

Digital Fundamentals (11th Edition)
Computer Science
ISBN:9780132737968
Author:Thomas L. Floyd
Publisher:PEARSON

C How to Program (8th Edition)
Computer Science
ISBN:9780133976892
Author:Paul J. Deitel, Harvey Deitel
Publisher:PEARSON

Database Systems: Design, Implementation, & Manag...
Computer Science
ISBN:9781337627900
Author:Carlos Coronel, Steven Morris
Publisher:Cengage Learning

Programmable Logic Controllers
Computer Science
ISBN:9780073373843
Author:Frank D. Petruzella
Publisher:McGraw-Hill Education