Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

In Java please: public class DNASequencing extends Objects{ /*Use a for loop to

ID: 3603789 • Letter: I

Question

In Java please:

public class DNASequencing extends Objects{


/*Use a for loop to visit each element in the array input
parameter. Remember that array indices start at 0, as do the indices of each character in a
String.
Prints out the contents of an array, one item per line.
Parameters:
strings - The array of String objects to be printed.*/
public static void printArray(String[] strings){
}


/*After completing and testing printArray, work on the findLongest or the findFrequency
methods; they are similar. Within both methods, use a loop to visit each element in the array.
In the findLongest method, you must keep track of which String object in the array
contains the most characters, whereas in the findFrequency method, you must keep track
of how many times a specific String object is found in the array. Make sure you finish
and test both of these before moving to the next step.
Finds the first occurrence of the longest item in an array of String objects. The length of a
String object is determined by its number of characters
Parameters:
strings - The array of String objects to search.
Returns:
The longest String object. If there is more than one, then the first occurrence is returned.
The first occurrence has the lowest index position in the array.*/
public static String findLongest(String[] strings){
}


/*Determines the number of times a particular item occurs within an array of String objects.
Parameters:
target - A string that is equivalent to the string(s) we are looking for.
strings - The array of String objects to search.
Returns:
The number of times an equivalent string to the target occurs within the array.*/
public static int findFrequency(String target, String[] strings){
}


/*This method examines the contents of the sequence array, looking for a specific sequence
and its mutations. By the time you have done all the other methods, this should be reasonably
simple. You may want to create a helper method, but it is not required
Determines the number of times a particular DNA sequence occurs within an array of DNA sequences.
A typical DNA sequence contains a sequence of two to four of the following characters: {A,C,G,T}.
A mutated sequence contains adjacent repeated characters , so TCA, TTCCCCA, and TCCAA are all equivalent,
TTCCCCA and TCCAA being mutations of TCA.
Parameters:
target - The exact sequence we are looking for, in its non-mutated form. The string is a valid DNA
sequence as defined in the CSC110 Assignment 5 instructions.
seqArray - An array of DNA sequences, as described in the CSC110 Assignment 5 instructions.
Returns:
The number of times an equivalent DNA sequence to the target DNA sequence occurs within the array.*/
public static int findFreqWithMutations(String target, String[] seqArray){
}

/*Implement this method by building on the technique for findFrequency and adding calls
to hasMutation.
Counts the number of mutated DNA sequences that occur within an array. Note that DNA sequences
contain two to four of the following characters: {A,C,G,T} in any order. A mutated sequence
contains adjacent repeated characters , so ACCG, TTCCA, and AACC are all mutated sequences.
Parameters:
seqArray - An array of DNA sequences, as described in the CSC110 Assignment 5 instructions.
Returns:
The number of mutated DNA sequences found within the array.*/
public static int countTotalMutations(String[] seqArray){
}


/*This method is probably the easier one to implement, so you can start with that. For
those of you who like an extra challenge, consider writing a more general method that
deals with any string and returns true if there are consecutive characters that are identical.
Experienced programmers often look for ways to make code that is re-usable, easy
to maintain, and modular. For example, suppose that you wish to create a more general
method (for possible future use) that deals with any string. And suppose it is called
hasCharacterRun.
After fully testing it, it is stored in your personal library (or toolkit) of code. Now, the
hasMutation method is very simple and requires no testing
Determines if a given DNA sequence has a mutation. A mutated sequence contains adjacent repeated characters,
so ACCG, TTCCA, and AACC are all mutated sequences.
Parameters:
sequence - A DNA sequence that may or may not have consecutive repeated bases.
Returns:
True if the sequence has a consecutive repeated base.*/
public static boolean hasMutation(String sequence){
}
//An internal tester to check the methods.
public static void main(String[] args){
}


}

Explanation / Answer

Code - For all the six methods code were written .Please check and provide feedback if any thing else required .

public static class DNASequencing extends Objects{

public static void main(String[] args){

//Method to print string array with each element in new line

public static void printArray(String[] strings){

}

//Method to find longest string in string array

public static String findLongest(String[] strings){

}

//Method to find frequency of a sting in array

public static int findFrequency(String target, String[] strings){

}

//Method to find number of times a DNA sequence appered to in DNA array

public static int findFreqWithMutations(String target, String[] seqArray){

}

//METHOD TO FIND NUMBER OF TIMES PARTICULAR DNA SEQUENCE ARRIVED IN ARRAY WITH MUTED .

public static int countTotalMutations(String[] seqArray){

}

//Method to check wheather sequence as repeated characters

public static boolean hasMutation(String sequence){

for (int i=0; i<str.length(); i++) {

            for (int j=i+1; j<str.length(); j++) {

                if (str.charAt(i) == str.charAt(j)) {

                    return true; }

} }

        return false;

    }

}

}

}

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote