subject

Write a method sameDashes that takes two Strings as parameters and that returns whether or not they have dashes in the same places (returning true if they do and returning false otherwise). For example, below are four pairs of Strings of equal length that have the same pattern of dashes. Notice that the last pair has no dashes at all. string 1: "hi--there-you." "-15-389" "criminal-plan" "abc"string 2: "12--(134)-7539" "-xy-zzy" "(206)555-1384" "9.8"To be considered a match, the Strings must have exactly the same number of dashes in exactly the same positions. The Strings might be of different length. For example, the following calls should each return true:sameDashes("1st-has-more characters", "2nd-has-less")sameDashes("1st-has- less", "2nd-has-more characters")because the Strings each have two dashes and they are in the same positions. But the following calls should each return falsebecause the longer string has a third dash where the shorter string does not:sameDashes("1st-has-more-charac ters", "2nd-has-less")sameDashes("1st-has- less", "2nd-has-more-characters")

ansver
Answers: 1

Another question on Computers and Technology

question
Computers and Technology, 22.06.2019 07:20
Write a pseudocode solution for each of these problems. 1. design a while loop that lets that user enter a number. the number should be multiplied by 10, and the result stored in a variable named product. the loop should iterate as long as product contains a value less than 100. 2. design a do-while loop that asks the user to enter two numbers. the numbers should be added and the sum displayed. the loop should ask the user whether he or she wishes to perform the operation again. if so, the loop should repeat; otherwise it should terminate. 3. design a for loop that displays the following set of numbers: 0, 10, 20, 30, 40, 50 100. 4. design a nested loop that displays 10 rows of # characters. there should be 15 # characters in each row. 5. convert this for loop to a while loop. declare integer count for count = 1 to 50 display count end for 6. find the error in the following pseudocode. declare boolean finished = false declare integer value, cube while not finished display β€œenter a value to be cubed.” input value; set cube = value ^ 3 display value, β€œ cubed is β€œ, cube end while
Answers: 2
question
Computers and Technology, 22.06.2019 10:30
Auniversity wants to install a client-server network. which feature do you think is important for them as they set up the network? sending email blocking multiple people to use the same file low security low set up cost limited access to files
Answers: 1
question
Computers and Technology, 23.06.2019 00:00
What engine component is shown in the above figure?
Answers: 1
question
Computers and Technology, 23.06.2019 11:30
The most accurate readings that you can take on an analog vom are when the meter's pointer is at the a. center scale. b. extreme right. c. near right. d. extreme left.
Answers: 1
You know the right answer?
Write a method sameDashes that takes two Strings as parameters and that returns whether or not they...
Questions
question
English, 03.04.2020 20:39
question
Mathematics, 03.04.2020 20:41
Questions on the website: 13722362