Question: Method mismatch: Write a static method named mismatch that accepts two Strings as parameters and returns the number of mismatches. Each String is assumed to

Method mismatch:
Write a static method named mismatch that accepts two Strings as parameters and returns
the number of mismatches. Each String is assumed to represent DNA sequence, that means
consists of capital A, C, G, and T letters only. For a match we need A and T to be lined up and C
and G to be lined up for every pair. For example, to get a mismatch A should line up with A, C or
G, or will not have a pair at all. See examples below.
Examples:
mismatch ("ATCGAT", "TAGCTA") returns 0
ATCGAT
|||||
TAGCTA
mismatch ("ATCGAT", "TAGCAA") returns 1
ATCGAT
||||x|
TAGCAA
mismatch ("ATCGAT", "TATCTT") returns 2
ATCGAT
||x||x
TATCTT
mismatch ("ATCG", "TATCTT") returns 3
ATCG
||x|
TATCTT
Note 1: You can use the above examples in your main to check the methods works as intended.
Note 2: You can assume a legit input to the method, so no need to check for input correctness.
Tip 1: This method returns things, that means to check it you need to call it and store or print
result.
Tip 2: When working with Strings methods like chartAt(i) and length() can be useful.
 Method mismatch: Write a static method named mismatch that accepts two

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!