Question: using java please Exercise home number 8 Study material for the exercise: Recursion In this exercise it is forbidden to use loops. A solution with

using java please
using java please Exercise home number 8 Study material for the exercise:
Recursion In this exercise it is forbidden to use loops. A solution

Exercise home number 8 Study material for the exercise: Recursion In this exercise it is forbidden to use loops. A solution with loops will not be accepted. In terms of working with the String class, only methods, (charAt 0.indexOf length 0.substring() Question 1 (100%) Write a class called DnaSequence which represents a sequence of DNA (DNA). DNA is the genetic material that appears in every living cell. From our point of view, this is a string consisting of only 4 letters: M, A, C, G (lower or upper case). A valid DNA sequence contains only these letters. These letters are called nucleotides. Studies in genetics and bioinformatics analyze such sequences and compute a variety of statistics. For example, we would like to calculate how many times each letter appears in the sequence. Fields The class contains two private fields: a. sequence - the DNA sequence that the class represents (String type) B. nucleotideCounts - A one-dimensional array of integers that counts how many times each letter appears in the sequence. The first place counts how many times the letter A (small or large) appears, the second place counts how many times the letter C (small or large) appears, the third place counts how many times the letter G (small or large) appears, and the fourth place counts how many times the letter T appears (Small or large). Constructors 1. An empty constructor which initializes the sequence sequence to be "ACGT" and the array accordingly. Builder Signature: public DnaSequence () 2. A builder who gets a sequence. If it is a valid DNA sequence, it initializes both fields accordingly. Otherwise, the initialization is done as in the blank constructor. Builder signature: public Dna Sequence (String sequence) 3. Copy builder: public Dna Sequence (Dna Sequence other) Methods 1. get methods for the fields: public String getSequence () public int ( getNucleotideCounts 0 2. Set method for the sequence: public void setSequence (String sequence) Notes: 1. Depending on the sequence update, the counts field must also be updated according to the new sequence 2. The update is performed only if the sequence parameter is a valid DNA sequence. Otherwise, the function does not change the object. 3. A static method that receives a string and checks whether it is a valid DNA sequence. Signature of the method: public static boolean isDna Sequence (String sequence) 4. A method that turns each small letter in sequence into a capital letter and vice versa. Signature of the method: public void changeCapitalization 5. A static method that accepts 2 arrays and adds the second to the first, without changing the second. If one of the arrays is null or the arrays are not the same length, the method returns false. Otherwise, true will be returned. Signature method: public static boolean addArray (int i arri, int ( arr2) 6. A method that chains a DNA sequence at the end of the sequence of this. In addition, the method updates the counts using the method from section 5. Signature of the method: public void concat Genes (Dna Sequence other) 7. The toString method, which returns string production for the object, contains the same sequence information and about the counts in the format: , , , ) Where csequence is the sequence, is the number of occurrences of "A" or "a", etc. For example, for an object representing the "ACGT" sequence the string would be: ACGT: (1, 1, 1, 1) Method signature: public String toString 0

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!