1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
vova2212 [387]
4 years ago
5

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, pri

nt out its complement as well as whether or not it is a Watson-Crick complemented palindrome.
Computers and Technology
1 answer:
Alekssandra [29.7K]4 years ago
5 0

Answer:

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<j; i++, j--){

          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();

  }

}

Explanation:

You might be interested in
Instructions:Select the correct answer.
Tju [1.3M]
E) Keep  top and left margins equal but larger than other margins
4 0
3 years ago
Read 2 more answers
By what date must federal taxes typically be filed and sent to the IRS?
marishachu [46]
April 15th of each annual year
6 0
4 years ago
What can Marla enter into cell A11 to find out how much money is left in her budget and to make sure the cell is updated wheneve
Nookie1986 [14]
Personally I have my budget spreadsheet with all of my expenses in columns. Then I have a column showing my estimated paycheck (updating with actual# later).  Then the formula in the "Remaining" column that I use is this:    sum((A1:A99)-A100)  Where A1 through A99 (or whatever# of expenses you have) and -A100 or whatever cell name your paycheck/money is entered into - and that's all I do.  I actually have a 3 year budget, including birthdays, holidays, vacations, etc. so that you can plan ahead for any expenses and save away any extra.
8 0
3 years ago
1. Write a program to prompt the user to enter a single character and respond back whether or not the character is valid dna. 2.
Nina [5.8K]

Answer:

Answer 1:

dna = input("Enter DNA type: ")

dna = dna.upper()

print(dna)

if dna == "A" or dna == "B" or dna == "Z":

   print("valid")

else:

   print("invalid")

Answer 2:

rna = input("Enter DNA type: ")

rna = rna.lower()

print(rna)

if rna == "m" or rna == "t" or rna == "r":

   print("valid")

else:

   print("invalid")

Answer 3:

dnaSquence = input("Enter the DNA sequence: ")

type = "valid"

for char in dnaSquence:

   if char not in ["A", "C", "G", "T"]:

       type = "invalid"

       break

print(type)

Answer 4:

rnaSquence = input("Enter the RNA sequence: ")

type = "valid"

for char in rnaSquence:

   if char not in ["A", "C", "G", "U"]:

       type = "invalid"

       break

print("valid")

Explanation:

There are three types of DNA; Type A, Type B and Type Z.

A DNA sequence consists of; A, C, G and T.

There are three types of RNA; mRNA, tRNA and rRNA.

An RNA sequence consists of; A, C, G and U.

Code Explanations:

Code 1:

dna = input("Enter DNA type: ")

dna = dna.upper()

print(dna)

if dna == "A" or dna == "B" or dna == "Z":

   print("valid")

else:

<em>    print("invalid")</em>

  1. prompts and Takes a single character input
  2. converts the character to upper case
  3. compares the input to the DNA types
  4. Prints "valid" for a valid input else prints "invalid"

Code 2:

rna = input("Enter DNA type: ")

rna = rna.lower()

print(rna)

if rna == "m" or rna == "t" or rna == "r":

   print("valid")

else:

<em>    print("invalid")</em>

<em />

  1. prompts and Takes a single character input
  2. converts the character to lower case
  3. compares the input to the RNA types
  4. Prints "valid" for a valid input else prints "invalid"

Code 3:

Answer 3:

dnaSquence = input("Enter the DNA sequence: ")

type = "valid"

for char in dnaSquence:

   if char not in ["A", "C", "G", "T"]:

       type = "invalid"

       break

print(type)

  1. It prompts for a DNA sequence.
  2. Declares a string variable "type" and initializes type to valid.
  3. The FOR loop checks every character in the DNA sequence.
  4. If the character is not in the list [A, C, G, T] type becomes invalid and the loop breaks and the type "invalid" is printed to the screen.
  5. if all the characters are in the list, then type will remain valid and will be printed to the screen.

Code 4:

rnaSquence = input("Enter the RNA sequence: ")

type = "valid"

for char in rnaSquence:

   if char not in ["A", "C", "G", "U"]:

       type = "invalid"

       break

print("valid")

  1. It prompts for a RNA sequence.
  2. Declares a string variable "type" and initializes type to valid.
  3. The FOR loop checks every character in the RNA sequence.
  4. If the character is not in the list [A, C, G, U] type becomes invalid and the loop breaks and the type "invalid" is printed to the screen.
  5. if all the characters are in the list, then type will remain valid and will be printed to the screen.

7 0
3 years ago
A web designer finds out after the launch that one of the external links did not have "http://' and therefore the link appeared
Bumek [7]
Answer is oc design testing
3 0
3 years ago
Other questions:
  • Which one of the following is an example of hacktivism according to you and why?
    11·1 answer
  • Feature of electric circuit​
    14·2 answers
  • Select the correct answer. One of the functions of a data warehouse is to change table names to meaningful names. Which name is
    13·1 answer
  • Do you think that feedly will help you create an effective personal online learning environment? Why or why not?
    15·1 answer
  • A technician suspects a network card is not working. Which tool should the technician use to test the network card?
    8·1 answer
  • Steven, Marcos, and Juan are having a free-throw shooting contest. Each boy
    9·1 answer
  • What does it mean to catch an exception?
    8·1 answer
  • What adaptation Judy and her parents have that help them run from predators coming?​
    6·1 answer
  • Select the correct answer from each drop-down menu. The following diagram shows four resistors. What is the effective resistance
    9·1 answer
  • When an AC voltage is being measured
    15·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!