Ask Question
22 September, 08:16

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.

+5
Answers (1)
  1. 22 September, 08:20
    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 & Technology if the answers seem to be not correct or there’s no answer. Try a smart search to find answers to similar questions.
Search for Other Answers