
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
Concept explainers
Question
Write a program that compares two strings given as input. Output the number of characters that match in each string position. The output should use the correct verb (match vs matches) according to the character count.
Ex: If the input is:
crash crush
the output is:
4 characters match
Ex: If the input is:
cat catnip
the output is:
3 characters match
Ex: If the input is:
mall saw
the output is:
1 character matches
Ex: If the input is:
apple orange
the output is:
0 characters match
![LAB
ACTIVITY
1 import
java.util.Scanner;
3 public class LabProgram {
INMON
2
4
5
6
7
8
9}
23.12.1: LAB: Matching strings
public static void main(String[] args) {
Scanner scnr = new Scanner(System.in);
/* Type your code here. */
}
LabPr](https://content.bartleby.com/qna-images/question/6b67a6a2-2d8c-4553-99c2-3c44a5ebdd4f/22411ef2-35f5-41be-843c-f0603a3df84f/f25ckbq_thumbnail.png)
Transcribed Image Text:LAB
ACTIVITY
1 import
java.util.Scanner;
3 public class LabProgram {
INMON
2
4
5
6
7
8
9}
23.12.1: LAB: Matching strings
public static void main(String[] args) {
Scanner scnr = new Scanner(System.in);
/* Type your code here. */
}
LabPr
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 4 steps with 2 images

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
- make a program, that has a function that takes in a string argument and prints a sentence indicating the shortest word in that string. If there is more than one word print only the first. Your print statement should read: “The shortest word is x” Where x = the shortest word. The word should be all uppercase.arrow_forwardI have the CSC 215 Computer Science I for Science and Engineering textbook on zybooks, and I need help figuring out how to solve this problem: Write a program that takes a string and an integer as input, and outputs a sentence using the input values as shown in the example below. The program repeats until the input string is quit and disregards the integer input that follows.arrow_forwardDesign a program with an algorithm that will take a string from the user and then decide if each character in that string is unique. For example, if you ask the user to enter a string and that user enters the world ‘hello’, the result of the algorithm implementedshould return ‘false’ or ‘not unique’. If the user enters a string such as the word ‘phone’ the program will return ‘true’ or ‘unique’ since every character in the word phone is unique and is not repeated. An example of this program follows: Output should show as : enter a string rizma This string has all the unique characters would u like to continue?(y for yes n for no) y Enter a string waali This string is not unique Your code should work for all strings and essentially all characters, as many examples will be tested.arrow_forward
- in C program pleasearrow_forwardWrite a program that reads two phrases on separate lines and outputs one of the four responses: 1) Phrase one is found within phrase two 2) Phrase two is found within phrase one 3) Both phrases match 4) No matches Hint: Use the String method indexOf(). Ex: If the input is: fire firetruck the output is: fire is found within firetruck Ex: If the input is: the green grass grows green grass the output is: green grass is found within the green grass grows Ex: If the input is: pick a card pick a card the output is: Both phrases match Ex: If the input is: apples oranges the output is: No matches(in java please)arrow_forwardWrite a program that compares two strings given as input. Output the number of characters that match in each string position. The output should use the correct verb (match vs matches) according to the character count. Assume each input strings have less than 50 characters. Ex: If the input is: crash crush the output is: 4 characters match Ex: If the input is: cat catnip the output is: 3 characters match Ex: If the input is: mall saw the output is: 1 character matches Ex: If the input is: apple orange the output is: 0 characters matcharrow_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