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
r-ruslan [8.4K]
3 years ago
5

Biologists use a sequence of letters A, C, T, and G to model a genome. A gene isa substring of a genome that starts after a trip

let ATG and ends before a tripletTAG, TAA, or TGA. Furthermore, the length of a gene string is a multiple of 3and the gene does not contain any of the triplets ATG, TAG, TAA, and TGA.Write a program that prompts the user to enter a genome and displays all genesin the genome. If no gene is found in the input sequence, the program displays nogene is found.Here are sample runs of the program:Enter a genome string: TTATGTTTTAAGGATGGGGCGTTAGTTTTTGGGCGTEnter a genome string: TGTGTGTATATno gene is found

Engineering
1 answer:
kogti [31]3 years ago
7 0

Answer:

You did not mention the programming language for implementation so i am writing a JAVA code.

import java.util.Scanner; // to get input from user

public class Genome{

public static void main(String[] args) { //start of main() function body

Scanner input = new Scanner(System.in); //creates Scanner object

System.out.print("Enter a genome string: ");

//prompts user to enter a genome string

String genome = input.nextLine();

//reads the input genome string and stores it into genome variable

boolean gene_found = false;

//variable gene_found of boolean type that has two value true or false

int startGene = 0; // stores starting of the gene string

for (int i = 0; i < genome.length() - 2; i++) {

//loop moves through genome string until the third last gene character

String triplet = genome.substring(i, i + 3);

//stores the triplet of genome substring

if (triplet.equals("ATG")) {

//if value in triplet is equal to ATG

startGene = i + 3;

//3 is added to i-th position of the genome string

}

else if (((triplet.equals("TAG")) || (triplet.equals("TAA")) || (triplet.equals("TGA"))) &&(startGene != 0))

//checks if the genome ends with one the given triplets TAG TAA and TGA

{ String gene = genome.substring(startGene, i);

gene stores substring of genome string from startGene to the position i

if (gene.length() % 3 == 0)

//if the the mod of gene length is 0 then the gene is found

{gene_found = true;

System.out.println(gene); //returns the found gene

startGene = 0;} } }

if (!gene_found) //if gene is not found returns the message below

System.out.println("no gene is found"); }  }

Explanation:

This program first asks user to enter a genome string.

The loop starts from the first character of the entered string and this loop continues to execute until the value of i is 2 less than the genome input string length.

triplet variable stores first 3 characters of the genome string in first iteration and then moves through the string taking 3 characters each. This is done by dividing genome string to substring of 3 characters.

If condition checks if the 3 characters of genome string matches ATG using equals() function. If it is true this means start of genome is reached and these triplets are stored in startGene.

Else condition checks the end of the genome as the genome ends before one of TAG, TAA or TGA triplets. So this is checked here.

gene variable holds the triplet value stored in startGene and the value stored in index position i which means it holds the start of the genome till the end of the genome sequence. The end which is pointed by i variable is 2 less than the genome length and it is stored in gene variable.

After the loop ends the substring stored in gene variable is checked for a valid genome sequence by mod operator. If the length of the value stored in gene variable mod 0 is equal to 0 this means genome sequence is found and this string sequence stored in gene is displayed else the no gene is found message is displayed on output screen.

You might be interested in
Products that are in the process of being manufactured but are not yet complete are called:
vazorg [7]

Answer:

Those products are generally called Work in Process WIP

Explanation:

Work in process (WIP), or work in progress (WIP), goods in process, or in-process inventory in a manufacturing industry/company refer to the company's partially finished goods waiting for completion and eventual sale or the value of these items.

These items are either just being produced or require further processing (like purification, separation, packaging or handling) in a queue or a buffer storage.

6 0
3 years ago
Your Java program will be reading input from a file name strInput.txt. Each record contains String firstname String lastName Str
stiks02 [169]

Answer:

The program requires that you have the specified input files and it reads from each file at a time and processes salary in digits, states the city, state and bonus with respective first and last name as requested in the question. Note that you must have access to the mentioned output files for the program to work properly. Below is the java version of the program.

import java.io.File;

import java.io.FileNotFoundException;

import java.io.PrintWriter;

import java.util.Scanner;

class Driver

{

public static void main(String[] args) throws FileNotFoundException

{

Scanner sc = new Scanner(new File("strInput.txt"));

PrintWriter pd = new PrintWriter(new File("strOutputD"));

PrintWriter prf = new PrintWriter(new File("strOutputRF"));

String firstname = "", lastname = "", strSalary = "", status = "", cityState = "", city = "", state = "";

double salary = 0, bonus = 0;

int incorrectRecords = 0;

int dRecords = 0;

int fRecords = 0;

while(sc.hasNextLine())

{

firstname = sc.next();

lastname = sc.next();

strSalary = sc.next();

status = sc.next();

cityState = sc.next();

if(!status.equals("D") && !status.equals("F"))

{

System.out.println("Records is neither D nor F. Skipping this...");

incorrectRecords++;

continue;

}

else if(status.equals("D") || status.equals("F"))

{

char c = ' ';

int i = 0;

for(i=0; i<strSalary.length() && c != '.'; i++)

{

c = strSalary.charAt(i);

if(!Character.isDigit(c))

{

System.out.println("Char at position " + (i+1) + " in salary is not a digit");

incorrectRecords++;

continue;

}

}

if(c == '.')

{

if(i+1 == strSalary.length()-1)

{

if(!Character.isDigit(strSalary.charAt(i)))

{

System.out.println("Char at position " + (i+1) + " in salary is not a digit");

incorrectRecords++;

continue;

}

if(!Character.isDigit(strSalary.charAt(i+1)))

{

System.out.println("Char at position " + (i+1+1) + " in salary is not a digit");

incorrectRecords++;

continue;

}

}

else

{

System.out.println("Period is in the wrong position. Expected at " + (strSalary.length()-3) + " but found at " + (i+1));

continue;

}

}

city = cityState.split(",")[0];

state = cityState.split(",")[1];

salary = Double.parseDouble(strSalary);

if(status.equals("D"))

{

bonus = salary * 0.125;

dRecords++;

pd.write(firstname + " " + lastname + " " + status + " " + salary + " " + bonus + " " + city + " " + state);

}

else

{

bonus = salary * 0.18;

fRecords++;

prf.write(firstname + " " + lastname + " " + status + " " + salary + " " + bonus + " " + city + " " + state);

}

}

}

System.out.println("No of D records : " + dRecords);

System.out.println("No of F records : " + fRecords);

System.out.println("No of incorrect records : " + incorrectRecords);

}

}

6 0
3 years ago
A light bar AD is suspended from a cable BE and supports a 20-kg block at C. The ends A and D of the bar are in contact with fri
babymother [125]

Answer:

Tension in cable BE= 196.2 N

Reactions A and D both are  73.575 N

Explanation:

The free body diagram is as attached sketch. At equilibrium, sum of forces along y axis will be 0 hence

T_{BE}-W=0 hence

T_{BE}=W=20*9.81=196.2 N

Therefore, tension in the cable, T_{BE}=196.2 N

Taking moments about point A, with clockwise moments as positive while anticlockwise moments as negative then

196.2\times 0.125- 196.2\times 0.2+ D_x\times 0.2=0

24.525-39.24+0.2D_x=0

D_x=73.575 N

Similarly,

A_x-D_y=0

A_x=73.575 N

Therefore, both reactions at A and D are 73.575 N

7 0
3 years ago
Explain what the ancient Romans did to solve the problem in the following scenario.
Nonamiya [84]

Answer:

They moved fresh water around their vast empire with aqueducts and canals.

Explanation:

6 0
3 years ago
List all possible fracture mechanisms under which the unidirectional composites fail. Briefly explain and describe the related m
professor190 [17]

Answer:

Ususushehehehhuuiiïbbb

Explanation:

Yyshehshehshshsheyysysueueue

7 0
2 years ago
Other questions:
  • In the 1960s through 1980s, a medical filter manufacturer in Ann Arbor discharged 1,4-dioxane (an industrial solvent) directly i
    10·1 answer
  • A 3.5-m3 rigid tank initially contains air whose density is 2 kg/m3 . The tank is connected to a high-pressure supply line throu
    8·1 answer
  • Two blocks of rubber with a modulus of rigidity G =10 MPa are bonded to rigid supports and to a plate AB. Knowing that b = 200 m
    8·1 answer
  • A harmonic oscillator with spring constant, k, and mass, m, loses 3 quanta of energy, leading to the emission of a photon.
    13·1 answer
  • Q1. Basic calculation of the First law (2’) (a) Suppose that 150 kJ of work are used to compress a spring, and that 25 kJ of hea
    6·1 answer
  • Fig. 4 shows a simply-supported beam with supports A and B. The beam is subjected to three forces, 2000 N, 4000 N and 1500 N in
    5·1 answer
  • What does it mean to say that PEER is a data-driven, consumer-centric, and comprehensive system?
    8·2 answers
  • Is an example of an electrical device.
    13·2 answers
  • Planetary gears require the armature to be offset via a gear housing that holds the starter drive.
    12·2 answers
  • As you push a toggle bolt into a wall, the
    13·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!