Ask Question
20 August, 12:32

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. 20 August, 13:11
    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?
Find 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 and Technology if you're in doubt about the correctness of the answers or there's no answer, then try to use the smart search and find answers to the similar questions.
Search for Other Answers