Ask Question
18 September, 04:20

Write a test client which takes a file path as an argument and reads each line one by one. If the current line is valid DNA, print out its complement as well as whether or not it is a Watson-Crick complemented palindrome.

+4
Answers (1)
  1. 18 September, 06:56
    0
    import java. io. BufferedReader;

    import java. io. FileReader;

    import java. io. IOException;

    import java. util. Scanner;

    public class WCComplement {

    public static boolean palindromeWC (String input) {

    if (input==null)

    return false;

    for (int i=0, j=input. length () - 1; i
    if (input. charAt (i) ! = input. charAt (j))

    return false;

    }

    return true;

    }

    public static void main (String[] args) throws IOException {

    Scanner sc = new Scanner (System. in);

    System. out. print ("Enter input file name: ");

    String fileName = sc. next ();

    FileReader fr = new FileReader (fileName);

    BufferedReader br = new BufferedReader (fr);

    String line;

    while ((line = br. readLine ()) ! = null) {

    if (palindromeWC (line))

    System. out. println (line+" is Watson-Crick complemented");

    }

    br. close ();

    fr. close ();

    sc. close ();

    }

    }
Know the Answer?
Not Sure About the Answer?
Get an answer to your question ✅ “Write a test client which takes a file path as an argument and reads each line one by one. If the current line is valid DNA, print out its ...” in 📙 Computers & Technology if there is no answer or all answers are wrong, use a search bar and try to find the answer among similar questions.
Search for Other Answers