Introduction to Java Programming and Data Structures, Comprehensive Version (11th Edition)
11th Edition
ISBN: 9780134670942
Author: Y. Daniel Liang
Publisher: PEARSON
expand_more
expand_more
format_list_bulleted
Concept explainers
Textbook Question
Chapter 10.10, Problem 10.10.4CP
Let s1 be “ Welcome ” and s2 be “ welcome ” Write the code for the following statements:
a. Replace all occurrences of the character e with E in s1 and assign the new string to s3.
b. Split Welcome to Java and HTML into an array tokens delimited by a space and assign the first two tokens into s1 and s2.
Expert Solution & Answer
Want to see the full answer?
Check out a sample textbook solutionStudents have asked these similar questions
Question 1.
1a)Given an array of strings, write Java code to find the string that would come earliest in the dictionary with the smallest value (Unicode) and its position in the array..
2. Identify and correct the errors in each of the following statements:
a) if ( c !< 17 );
window.alert( "c is not less than 17" );
b) if ( c =< 17 )
window.alert( "c is equal to or less than 17" );
c) while ( c <= 5 ) {
product *= c;
++c;
d) if ( gender == 1 )
document.writeln( "Woman" );
else;
document.writeln( "Man" );
e)var a = new Array( 20);
for ( varj = 0; j = 30, ++i ){
a[ j ] = 0;
}
Write Java code to display the names below in a 4 x 4 array: Zanele Justice Ken Lebo Tebu Gugu Ndaba Mudau Zizile Andrew Tian Ruan Daniel Fabian Kagiso Xoliswa.
Use Java NetBeans to transpose the names on the matrix, such that the names in the rows should appear in the columns and vice versa. Then, replace the names on the left diagonal with double asterisks: ***".
Chapter 10 Solutions
Introduction to Java Programming and Data Structures, Comprehensive Version (11th Edition)
Ch. 10.2 - Prob. 10.2.1CPCh. 10.3 - Is the BMI class defined in Listing 10.4...Ch. 10.4 - Prob. 10.4.1CPCh. 10.4 - Prob. 10.4.2CPCh. 10.4 - Prob. 10.4.3CPCh. 10.4 - Prob. 10.4.4CPCh. 10.7 - Prob. 10.7.1CPCh. 10.7 - Prob. 10.7.2CPCh. 10.7 - How do you convert an integer into a string? How...Ch. 10.7 - Show the output of the following code: public...
Ch. 10.7 - Prob. 10.7.5CPCh. 10.8 - What are autoboxing and autounboxing? Are the...Ch. 10.8 - Show the output of the following code. public...Ch. 10.9 - What is the output of the following code? public...Ch. 10.10 - Suppose s1, s2, s3, and s4 are four strings, given...Ch. 10.10 - To create the string Welcome to Java, you may use...Ch. 10.10 - What is the output of the following code? String...Ch. 10.10 - Let s1 be Welcome and s2 be welcome Write the...Ch. 10.10 - Prob. 10.10.5CPCh. 10.10 - Prob. 10.10.6CPCh. 10.10 - Prob. 10.10.7CPCh. 10.10 - Prob. 10.10.8CPCh. 10.10 - What is wrong in the following program? 1public...Ch. 10.10 - Show the output of the following code: public...Ch. 10.10 - Show the output of the following code: public...Ch. 10.11 - Prob. 10.11.1CPCh. 10.11 - Prob. 10.11.2CPCh. 10.11 - Prob. 10.11.3CPCh. 10.11 - Prob. 10.11.4CPCh. 10.11 - Prob. 10.11.5CPCh. 10.11 - Suppose s1 and s2 are given as fot tows:...Ch. 10.11 - Show the output of the following program: public...Ch. 10 - (The Time class) Design a class named Time. The...Ch. 10 - (The BMI class) Add the following new constructor...Ch. 10 - (The MyInteger class) Design a class named...Ch. 10 - Prob. 10.4PECh. 10 - (Display the prime factors) Write a program that...Ch. 10 - (Display the prime numbers) Write a program that...Ch. 10 - Prob. 10.7PECh. 10 - Prob. 10.8PECh. 10 - (The Course class) Revise the Course class as...Ch. 10 - Prob. 10.10PECh. 10 - Prob. 10.11PECh. 10 - (Geometry: the Triangle2D class) Define the...Ch. 10 - (Geometry: the MyRectangle 2D class) Define the...Ch. 10 - (The MyDate class) Design a class named MyDate....Ch. 10 - (Geometry: the bounding rectangle) A bounding...Ch. 10 - (Divisible by 2 or 3) Find the first 10 numbers...Ch. 10 - (Square numbers) Find the first 10 square numbers...Ch. 10 - (Mersenne prime)A prime number is called a...Ch. 10 - (Approximate e) Programming Exercise 5.26...Ch. 10 - (Divisible by 5 or 6) Find the first 10 numbers...Ch. 10 - (Implement the String class) The String class is...Ch. 10 - (Implement the String class) The String class is...Ch. 10 - (Implement the Character class) The Character...Ch. 10 - (New string split method) The split method in the...Ch. 10 - (Implement the StringBuilder class) The...Ch. 10 - (Implement the StringBuilder class) The...
Additional Engineering Textbook Solutions
Find more solutions based on key concepts
Describe the purpose of the access key attribute and how it supports accessibility.
Web Development and Design Foundations with HTML5 (9th Edition) (What's New in Computer Science)
Rainfall Statistics Modification Modify the Rainfall Statistics program you wrote for Programming Challenge 2 o...
Starting Out with C++ from Control Structures to Objects (8th Edition)
What output will be produced by the following code, when embedded in a complete program? int x = 2; cout Start...
Problem Solving with C++ (9th Edition)
If the name of getBalance is changed to getAmount, does the return statement in the body of the method also nee...
Objects First with Java: A Practical Introduction Using BlueJ (6th Edition)
Consider the adage Never ask a question for which you do not want the answer. a. Is following that adage ethica...
Experiencing MIS
Thetakes the .class files containing the programs bytecodes and transfers them to primary memory.
Java How To Program (Early Objects)
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
- Java Create a string array of 46 names and assign “Washington” to the first element of the array and “Biden” to the last element of the array.arrow_forward1)Examine the above code that creates the array: a)How is the base type of the array specified? b)How is the length of the array specified? c)How many Strings are actually stored in the array after the array has been created? d)How is the base type of the ArrayList specified? e)How is the capacity of the ArrayList specified? f)What is the capacity of the ArrayList? g)What is the size of the ArrayList?arrow_forwardCould you please help me with this java practice. Please provide comments in the code to help me understand. I am primarily having trouble with reading the contents of a file and loading the objects into an array. Also creating A loop to loop through each iteration of the array and print out the two string of each element.arrow_forward
- The most commonly used arrays in business applications are ____-dimensional and ____-dimensional. a. zero, one c. two, three b. one, two d. three, four If N is the number of variables in an array, the last variable of the array is assigned a subscript of ____. a. N-2 c. N b. N-1 d. N+1 The statement ____ assigns the character X to the first element of the letters array. a. letters[0] = 'X'; c. letters[1] = 'X'; b. letters[1] = "X"; d. letters[0] = "X"; A subscript is also called a(n) ____. a. iterator c. key b. index d. scalar When using bubble sort to sort an array in ascending order, at the end of the first pass, the ____ value is stored in the last position of the array. a. median c. largest b. mean d. smallest ____ declares and initializes a four-element string array named sales; each element is initialized to 0.0. a. string…arrow_forward#2. Using a 2 by 2 x 2 three-dimensional arrays, write a program that asks the user to inputtwo names of the students, with two grades in four subjects. in Java languageClass Name: StudentsNameandGradeSample Input/OutputEnter name of a student: Philip MojaresEnter grade 1 : 80Enter grade 2: 86Enter grade 3: 86Enter grade 4: 80The average is: 83Enter name of a student: Jose VillaEnter grade 1 : 95 2 Enter grade 2: 95Enter grade 3: 95Enter grade 4: 90The average is: 100The average is: 95arrow_forward18.Define a JavaScript array with four elements, and give each a initial value.arrow_forward
- Question 2: Control Flow Statementsa) Write a Java code snippet to print all the even numbers between 1 and 20 (inclusive). b) Write a Java code snippet to check if a given number num is positive, negative, or zero. Print the appropriate message.Your code for this problem c) Declare and initialize an integer array named "numbers" with the following elements: 4, 9, 2, 7, 5. d) Write a Java code snippet to calculate and print the sum of all elements in the "numbers" array.arrow_forwardConsider the following C++ code. string seasons[4] = {"Winter", "Spring", "Summer", "Fall"};string *strPtr;strPtr = new string[5];for (int i = 0; i < 4; i++)strPtr[i] = seasons[i];a. Write a C++ code that outputs the contents of the array to which strPtr points.b. Write the C++ statement that deallocates the memory space occupied by the array to which strPtr points.arrow_forward1. A.Write a program for displaying the string declared in an array, str[] = "hello",in reverse order of characters using pointers. B.Write a program for initializing from another vector that will output 10 20 30arrow_forward
- Can help in java String [] names = {"Dimo Ivanov", "Yani Yanev", "Ana Popova", "Nelly Angelova"}; 1. Get the arrays of names and surnames containing initial and second names, respectively (first determine the position of the space in the previous name with the indexOf () method of the String class). Display the arrays. 2. Sort the first_names array 3. Enter a name from the console using Scanner, look for an entered name contained in the first_names array and display the resultsarrow_forwardUsing java in netbeans Create a two-dimensional array of type double to contain the three different SD Marks (JD521, PRG521, and IP521) for six different students. A single array of type String must be used to store the student names (Maxwell, Carl, Gerhard, Paul, James, and Cena). Allow a user to enter in a number, ranging from 1 to 6, which will represent the student position in the table MCSD max and present the marks for each respecting module. The program can only stop when the user enter a number greater than 6. Printout the student name including the JD521, PRG521, and IP521 max, the total of marks and the average of all marks. Use a condition statement to decide that the student has passed or not (Pass rate is 70). Student name JD521 PRG521 IPG521 Maxwell 80 65 70 Carl 95 70 65 Gerhard 87 80 73 Paul 65 45 60 James 45 87 65arrow_forwardm an array ( 11 size) of ahammr fmm user and make a string from these en‘trm and prlm this letter and in reverse prder | | am beginner in javaarrow_forward
arrow_back_ios
SEE MORE QUESTIONS
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
Computational Software for Intelligent System Design; Author: Cadence Design Systems;https://www.youtube.com/watch?v=dLXZ6bM--j0;License: Standard Youtube License