View the step-by-step solution to:

3" MP5 [~/IdeaProjects/MP5xinhuic2] .lsrc/main/java/DNAljava [MP5_main] is; eeradewsv' > as e IVvlabam I MP5-xlnhulc2> I src) I:...

please help me finish last part in this assignment(DNA.Java), I also uploaded the test case below and the format in picture.

please use the software intelij

  • I copy the assignment link below:https://cs125.cs.illinois.edu/MP/5/?from=singlemessage&isappinstalled=0java.jpg

import java.util.ArrayList;

import java.util.Collections;

import java.util.Arrays;

import java.util.List;

import org.testng.annotations.Test;

import junit.framework.Assert;


/**

 * Test suite for the DNA class.

 * <p>

 * The provided test suite is correct and complete. You should not need to modify it. However, you

 * should understand it.

 *

 * @see < a href=" ">MP5 Documentation</ a>

 */

public class DNATest {


  /** Timeout for DNA tests. Solution takes 713 ms.*/

  private static final int DNA_TEST_TIMEOUT = 7130;


  /**

   * Test longest common subsequence.

   */

  @Test(timeOut = DNA_TEST_TIMEOUT)

  public void testLongestCommonSubsequence() {

    for (DNATestResult testResult : PRECOMPUTED_DNA_TEST_RESULTS) {

      String lcs = DNA.getLongestCommonSubsequence(testResult.firstSequence,

          testResult.secondSequence).getSequence().toUpperCase();

      Assert.assertTrue(testResult.longestCommonSubsequences.contains(lcs));

    }

  }

  /**

   * Class for storing trees and pre-computed results for the DNA tests.

   */

  public static class DNATestResult {


    /** First DNA sequence to compare. */

    DNA firstSequence;


    /** Second DNA sequence to compare. */

    DNA secondSequence;


    /** Result of the comparison. */

    List<String> longestCommonSubsequences;


    /**

     * Create a new input for the DNA tests.

     *

     * @param setFirstSequence first DNA sequence to compare

     * @param setSecondSequence second DNA sequence to compare

     * @param setLongestCommonSubsequences result of the comparison

     */

    public DNATestResult(final DNA setFirstSequence, final DNA setSecondSequence,

        final List<String> setLongestCommonSubsequences) {

      firstSequence = setFirstSequence;

      secondSequence = setSecondSequence;

      longestCommonSubsequences = setLongestCommonSubsequences;

    }

  }


  /** Pre-computed DNA results to use for testing. */

  private static final List<DNATestResult> PRECOMPUTED_DNA_TEST_RESULTS = //

      new ArrayList<>();


  static {

    PRECOMPUTED_DNA_TEST_RESULTS.add(new DNATestResult(

        new DNA("ACTG"), new DNA("ACTG"), Collections.singletonList(

          "ACTG"

        )));

    PRECOMPUTED_DNA_TEST_RESULTS.add(new DNATestResult(

        new DNA("ACTG"), new DNA("AACCTTGG"), Collections.singletonList(

          "ACTG"

        )));

    PRECOMPUTED_DNA_TEST_RESULTS.add(new DNATestResult(

        new DNA("AACC"), new DNA("TTGG"), Collections.singletonList(

          ""

        )));

    /* BEGIN AUTOGENERATED CODE */

    PRECOMPUTED_DNA_TEST_RESULTS.add(new DNATestResult(

        new DNA("gtcGCATtGCA"),

        new DNA("ActTtCGCt"), Arrays.asList(

        "TCGCT",

        "TTTGC",

        "CTTGC",

        "ATTGC"

        )));

    PRECOMPUTED_DNA_TEST_RESULTS.add(new DNATestResult(

        new DNA("gAAaTaCAAaAaAAt"),

        new DNA("aCcT"), Collections.singletonList(

        "ACT"

        )));

    PRECOMPUTED_DNA_TEST_RESULTS.add(new DNATestResult(

        new DNA("aCCGTAaCt"),

        new DNA("AAaG"), Collections.singletonList(

        "AAA"

        )));

    PRECOMPUTED_DNA_TEST_RESULTS.add(new DNATestResult(

        new DNA("agTCTccgTTCT"),

        new DNA("AGCcccG"), Arrays.asList(

        "AGCCCG",

        "AGCCCC"

        )));

    PRECOMPUTED_DNA_TEST_RESULTS.add(new DNATestResult(

        new DNA("aCCTtccaatT"),

        new DNA("AaGCagaCtt"), Collections.singletonList(

        "ACAATT"

        )));

    PRECOMPUTED_DNA_TEST_RESULTS.add(new DNATestResult(

        new DNA("GTGtaaTCtt"),

        new DNA("TcTcACct"), Collections.singletonList(

        "TTACT"

        )));

    PRECOMPUTED_DNA_TEST_RESULTS.add(new DNATestResult(

        new DNA("GtcCGCC"),

        new DNA("cTgTaC"), Arrays.asList(

        "GTC",

        "TGC",

        "CGC"

        )));

    PRECOMPUTED_DNA_TEST_RESULTS.add(new DNATestResult(

        new DNA("AtattcGaT"),

        new DNA("cGaGTaagcAgt"), Arrays.asList(

        "ATACGT",

        "ATACAT",

        "ATAGAT"

        )));

    PRECOMPUTED_DNA_TEST_RESULTS.add(new DNATestResult(

        new DNA("GCTgGTAgtGaAGc"),

        new DNA("TCATgccATaA"), Collections.singletonList(

        "CTGATAA"

        )));

    PRECOMPUTED_DNA_TEST_RESULTS.add(new DNATestResult(

        new DNA("CCTTcCGGatGtTT"),

        new DNA("AGctAcACA"), Collections.singletonList(

        "CTCCA"

        )));

    PRECOMPUTED_DNA_TEST_RESULTS.add(new DNATestResult(

        new DNA("GCgcTaTcttcg"),

        new DNA("cGCTAGCTAaTGGAGA"), Collections.singletonList(

        "CGCTACTTG"

        )));

    PRECOMPUTED_DNA_TEST_RESULTS.add(new DNATestResult(

        new DNA("cCGaCGgGTg"),

        new DNA("ggCTG"), Arrays.asList(

        "GCTG",

        "GGTG"

        )));

    PRECOMPUTED_DNA_TEST_RESULTS.add(new DNATestResult(

        new DNA("aTtAcgtcaGCAg"),

        new DNA("GaaGaacGgTaTGgac"), Arrays.asList(

        "AACGTAGC",

        "AACGTAGA",

        "AACGTAGG"

        )));

    PRECOMPUTED_DNA_TEST_RESULTS.add(new DNATestResult(

        new DNA("gTgCagcTctgGtc"),

        new DNA("GACTtCaTtgCcTAcG"), Arrays.asList(

        "GTCAGCTCG",

        "GTCAGCCTG",

        "GTCAGCCTC",

        "GTCATTGTC",

        "GACTCTGTC"

        )));

    PRECOMPUTED_DNA_TEST_RESULTS.add(new DNATestResult(

        new DNA("tGaAagctGg"),

        new DNA("TGTagTT"), Collections.singletonList(

        "TGAGT"

        )));

    PRECOMPUTED_DNA_TEST_RESULTS.add(new DNATestResult(

        new DNA("aTtATG"),

        new DNA("TcGcaTgT"), Collections.singletonList(

        "TATG"

        )));

    PRECOMPUTED_DNA_TEST_RESULTS.add(new DNATestResult(

        new DNA("taCA"),

        new DNA("CttataTcCcGGGcC"), Arrays.asList(

        "TAC",

        "TAA"

        )));

    PRECOMPUTED_DNA_TEST_RESULTS.add(new DNATestResult(

        new DNA("ccCAG"),

        new DNA("CGtTAta"), Arrays.asList(

        "CA",

        "CG"

        )));

    PRECOMPUTED_DNA_TEST_RESULTS.add(new DNATestResult(

        new DNA("AaGtCGTcC"),

        new DNA("gTAatcgGcaCA"), Collections.singletonList(

        "AATCGCC"

        )));

    PRECOMPUTED_DNA_TEST_RESULTS.add(new DNATestResult(

        new DNA("AtGCtCaATGTTgGtg"),

        new DNA("CGGGCattACcCA"), Arrays.asList(

        "ATCCA",

        "ATTCA",

        "GCTCA",

        "ATTAA",

        "GCTAA",

        "GCATT",

        "CCATT",

        "CGGGT"

        )));

    /* END AUTOGENERATED CODE */

  }

  • }
java.jpg

3“ MP5 [~/IdeaProjects/MP5—xinhuic2] — ...lsrc/main/java/DNAljava [MP5_main] is; eeradewsv‘ &gt; as e IVvlabéam I MP5-xlnhulc2&gt; I src) I: maln) I java &gt; . DNA) E Project v 0 1 cu r~ . DNA.iava x %
V IgMPS-xinhuiCZ [MP5] ~/ldeaPro 1 'JS/aek I i
y I,gradle 2 * A class that represents a DNA sequence. g:
&gt; I .idea 3 * &lt;p&gt; E
. 4 &gt;1: Internally the class represents DNA as a string. You are responsible for implementing the longest
2 ’ - build 5 a: common subsequeage method and a straightforward constructor. G
= V Iconfig 6 * &lt;p&gt; o
E y - docs 7 * The DNA class does not need to provide a setter for the sequence, meaning that it can be allowed 3
”I 8 * to not change after the instance is created. As a result, it should not provide an empty 5
-- &gt; Igradle
&quot;' 9 * constructor.
S: &gt; Iout 10 * m
V Isrc 11 a: @see &lt;a href=&quot;https://L'5125.cs.illinois.edu/MP/5/&quot;&gt;MP5 Documentation&lt;la&gt; g
v Ilmain 12 t: */ %
V Ijava 3 public class WA { g
. DNA 15 /** Sequence of base pairs for this DNA instance. */ E
. SingIeLL 16 private String sequence; :0
Tree 17
It t. 18 lacs
7 I es. 19 * Gets the sequence of base pairs for this DNA instance.
V Ijava 20 a:
* @return the sequence of base pairs for this DNA instance
‘SingleLLTest 22 E */ .
23 + ublic Strin etSe uence return 5 uence-
.TreeTest 26 P 9 9 q () { eq . }
fl .gitignore 27 '7 In:
(5) build.gradle 28 * Create a new DNA instance from the given sequence of base pairs.
. . 29 * &lt;p&gt;
1‘ emall'tXt . 3e * The constructor should validate and normalize its inputs. All characters in the string should
[I'llgradlepropertles 31 * be from the set A, T, C, and 6 (this in DNA, not RNA). You should accept lower—case inputs
fl gradlew 32 * but convert them to upper—case for the purposes of later comparison.
i gradlewbat 33 * m ts th f b ' t ' ‘t‘ 1' th ' t 'th
Gsettingsgradle g: ,7 :/ ram se equence e sequence a ase pairs 0 ini ia ize e ins ance m.
V lllll External Libraries 36 public meinal String setSequence) { sequence = setSequence.toUpperCase(): }
39 , /**
40 * Return the longest common W of the two provided DNA sequences.
41 * &lt;p&gt;
42 * Mrs»: firstSequence the first DNA sequence to compare I
43 * when secondSequence - the second DNA sequence to compare
44 a: greturn the longest common W between the two provided DNA sequences
45 :_ */
:93 46 public static DNA getLongestCommoan/geglggfiinal WA firstSequence,
g 47 ’3 final ILNA secondSequence) {
3 48 i
(GI 49 return firstSequence;
* DNA &gt; sequence
Q g: TODO v 2: Version Control 9; Checkstyle Terminal !| 9: Messages . Evem Log
Push successful: Pushed1commit to origin/master (today 12:13 AM) 15:35 LF: UTF-8: Gitzmaster: ’iz g

Recently Asked Questions

Why Join Course Hero?

Course Hero has all the homework and study help you need to succeed! We’ve got course-specific notes, study guides, and practice tests along with expert tutors.

-

Educational Resources
  • -

    Study Documents

    Find the best study resources around, tagged to your specific courses. Share your own to gain free Course Hero access.

    Browse Documents
  • -

    Question & Answers

    Get one-on-one homework help from our expert tutors—available online 24/7. Ask your own questions or browse existing Q&A threads. Satisfaction guaranteed!

    Ask a Question