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
A charge of +2.00 μC is at the origin and a charge of –3.00 μC is on the y axis at y = 40.0 cm . (a) What is the potential at po
Nimfa-mama [501]

a) Potential in A: -2700 V

b) Potential difference: -26,800 V

c) Work: 4.3\cdot 10^{-15} J

Explanation:

a)

The electric potential at a distance r from a single-point charge is given by:

V(r)=\frac{kq}{r}

where

k=8.99\cdot 10^9 Nm^{-2}C^{-2} is the Coulomb's constant

q is the charge

r is the distance from the charge

In this problem, we have a system of two charges, so the total potential at a certain point will be given by the algebraic sum of the two potentials.

Charge 1 is

q_1=+2.00\mu C=+2.00\cdot 10^{-6}C

and is located at the origin (x=0, y=0)

Charge 2 is

q_2=-3.00 \mu C=-3.00\cdot 10^{-6}C

and is located at (x=0, y = 0.40 m)

Point A is located at (x = 0.40 m, y = 0)

The distance of point A from charge 1 is

r_{1A}=0.40 m

So the potential due to charge 2 is

V_1=\frac{(8.99\cdot 10^9)(+2.00\cdot 10^{-6})}{0.40}=+4.50\cdot 10^4 V

The distance of point A from charge 2 is

r_{2A}=\sqrt{0.40^2+0.40^2}=0.566 m

So the potential due to charge 1 is

V_2=\frac{(8.99\cdot 10^9)(-3.00\cdot 10^{-6})}{0.566}=-4.77\cdot 10^4 V

Therefore, the net potential at point A is

V_A=V_1+V_2=+4.50\cdot 10^4 - 4.77\cdot 10^4=-2700 V

b)

Here we have to calculate the net potential at point B, located at

(x = 0.40 m, y = 0.30 m)

The distance of charge 1 from point B is

r_{1B}=\sqrt{(0.40)^2+(0.30)^2}=0.50 m

So the potential due to charge 1 at point B is

V_1=\frac{(8.99\cdot 10^9)(+2.00\cdot 10^{-6})}{0.50}=+3.60\cdot 10^4 V

The distance of charge 2 from point B is

r_{2B}=\sqrt{(0.40)^2+(0.40-0.30)^2}=0.412 m

So the potential due to charge 2 at point B is

V_2=\frac{(8.99\cdot 10^9)(-3.00\cdot 10^{-6})}{0.412}=-6.55\cdot 10^4 V

Therefore, the net potential at point B is

V_B=V_1+V_2=+3.60\cdot 10^4 -6.55\cdot 10^4 = -29,500 V

So the potential difference is

V_B-V_A=-29,500 V-(-2700 V)=-26,800 V

c)

The work required to move a charged particle across a potential difference is equal to its change of electric potential energy, and it is given by

W=q\Delta V

where

q is the charge of the particle

\Delta V is the potential difference

In this problem, we have:

q=-1.6\cdot 10^{-19}C is the charge of the electron

\Delta V=-26,800 V is the potential difference

Therefore, the work required on the electron is

W=(-1.6\cdot 10^{-19})(-26,800)=4.3\cdot 10^{-15} J

4 0
3 years ago
computer language C++ (Connect 4 game)( this is all the info that was givin no input or solution) I used the most recent version
Mariana [72]

Answer:

C++ code explained below

Explanation:

#include "hw6.h"

//---------------------------------------------------

// Constructor function

//---------------------------------------------------

Connect4::Connect4()

{

ClearBoard();

}

//---------------------------------------------------

// Destructor function

//---------------------------------------------------

Connect4::~Connect4()

{

// Intentionally empty

}

//---------------------------------------------------

// Clear the Connect4 board

//---------------------------------------------------

void Connect4::ClearBoard()

{

// Initialize Connect4 board

for (int c = 0; c < COLS; c++)

for (int r = 0; r < ROWS; r++)

board[r][c] = ' ';

// Initialize column counters

for (int c = 0; c < COLS; c++)

count[c] = 0;

}

//---------------------------------------------------

// Add player's piece to specified column in board

//---------------------------------------------------

bool Connect4::MakeMove(int col, char player)

{

// Error checking

if ((col < 0) || (col >= COLS) || (count[col] >= ROWS))

return false;

// Make move

int row = count[col];

board[row][col] = player;

count[col]++;

return true;

}

//---------------------------------------------------

// Check to see if player has won the game

//---------------------------------------------------

bool Connect4::CheckWin(char player)

{

// Loop over all starting positions

for (int c = 0; c < COLS; c++)

for (int r = 0; r < ROWS; r++)

if (board[r][c] == player)

{

// Check row

int count = 0;

for (int d = 0; d < WIN; d++)

if ((r+d < ROWS) &&

(board[r+d][c] == player)) count++;

if (count == WIN) return true;

 

// Check column

count = 0;

for (int d = 0; d < WIN; d++)

if ((c+d < COLS) &&

(board[r][c+d] == player)) count++;

if (count == WIN) return true;

 

// Check first diagonal

count = 0;

for (int d = 0; d < WIN; d++)

if ((r+d < ROWS) && (c+d < COLS) &&

(board[r+d][c+d] == player)) count++;

if (count == WIN) return true;

 

// Check second diagonal

count = 0;

for (int d = 0; d < WIN; d++)

if ((r-d >= 0) && (c+d < COLS) &&

(board[r-d][c+d] == player)) count++;

if (count == WIN) return true;

}

return false;

}

//---------------------------------------------------

// Print the Connect4 board

//---------------------------------------------------

void Connect4::PrintBoard()

{

// Print the Connect4 board

for (int r = ROWS-1; r >= 0; r--)

{

// Draw dashed line

cout << "+";

for (int c = 0; c < COLS; c++)

cout << "---+";

cout << "\n";

// Draw board contents

cout << "| ";

for (int c = 0; c < COLS; c++)

cout << board[r][c] << " | ";

cout << "\n";

}

// Draw dashed line

cout << "+";

for (int c = 0; c < COLS; c++)

cout << "---+";

cout << "\n";

// Draw column numbers

cout << " ";

for (int c = 0; c < COLS; c++)

cout << c << " ";

cout << "\n\n";

}

//---------------------------------------------------

// Main program to play Connect4 game

//---------------------------------------------------

int main()

{

  int choice;

  int counter = 0;

  srand (time(NULL));

  Connect4 board;

  cout << "Welcome to Connect 4!" << endl << "Your Pieces will be labeled 'H' for human. While the computer's will be labeled 'C'" << endl;

  board.PrintBoard();

  cout << "Where would you like to make your first move? (0-6)";

  cin >> choice;

  while (board.MakeMove(choice,'H') == false){

  cin >> choice;

  }

  counter++;

  while (board.CheckWin('C') == false && board.CheckWin('H') == false && counter != 21){

  while (board.MakeMove(rand() % 7, 'C') == false){}

  board.PrintBoard();

  cout << "Where would you like to make your next move?" << endl;

  cin >> choice;

  board.MakeMove(choice,'H');

  while (board.MakeMove(choice,'H') == false){

  cin >> choice;

  }

  counter++;

  }

 

  if (board.CheckWin('C')){

  cout << "Computer Wins!" << endl;}

  else if (counter == 21){cout << "Tie Game!" << endl;}

  else {cout << "Human Wins!" << endl;}

  board.PrintBoard();

}

4 0
3 years ago
What are the functions of each computer program
Ludmilka [50]
A function is a block of organized, reusable code that is used to perform a single, related action. Functions provide better modularity for your application and a high degree of code reusing. ... Different programming languages name them differently, for example, functions, methods, sub-routines, procedures, etc.
4 0
3 years ago
Exhaust gas from a furnace is used to preheat the combustion air supplied to the furnace burners. The gas, which has a flow rate
Monica [59]

Answer:

The total tube surface area in m² required to achieve an air outlet temperature of 850 K is 192.3 m²

Explanation:

Here we have the heat Q given as follows;

Q = 15 × 1075 × (1100 - t_{A2}) = 10 × 1075 × (850 - 300) = 5912500 J

∴ 1100 - t_{A2} = 1100/3

t_{A2}  = 733.33 K

\Delta \bar{t}_{a} =\frac{t_{A_{1}}+t_{A_{2}}}{2} - \frac{t_{B_{1}}+t_{B_{2}}}{2}

Where

\Delta \bar{t}_{a} = Arithmetic mean temperature difference

t_{A_{1} = Inlet temperature of the gas = 1100 K

t_{A_{2} = Outlet temperature of the gas = 733.33 K

t_{B_{1} =  Inlet temperature of the air = 300 K

t_{B_{2} = Outlet temperature of the air = 850 K

Hence, plugging in the values, we have;

\Delta \bar{t}_{a} =\frac{1100+733.33}{2} - \frac{300+850}{2} = 341\tfrac{2}{3} \, K = 341.67 \, K

Hence, from;

\dot{Q} = UA\Delta \bar{t}_{a}, we have

5912500  = 90 × A × 341.67

A = \frac{5912500  }{90 \times 341.67} = 192.3 \, m^2

Hence, the total tube surface area in m² required to achieve an air outlet temperature of 850 K = 192.3 m².

4 0
3 years ago
Handsaw teeth are very sharp: to avoid being cut by the teeth, keep hands and fingers well away from the
siniylev [52]
Handsaw teeth are very sharp: to avoid being cut by the teeth, keep hands and fingers well away from the
path of the blade
6 0
3 years ago
Read 2 more answers
Other questions:
  • In a study comparing banks in Germany and Great Britain, a sample of 145 matched pairs of banks was formed. Each pair contained
    12·1 answer
  • The following laboratory tests are performed on aggregate samples:a. Specific gravity and absorptionb. Soundnessc. Sieve analysi
    13·1 answer
  • 1. What is an op-amp? List the characteristics of an ideal op-amp
    11·1 answer
  • What is temperature coefficient of resistance
    12·1 answer
  • A teenager was pulling a prank and placed a large stuffed penguin in the middle of a roadway. A driver is traveling on this leve
    13·1 answer
  • In homes today, what is behind the reason for flashover fires occurring much more rapidly than in the past generations?
    8·1 answer
  • In the long run, if the firm decides to keep output at its initial level, what will it likely do? Stay on SRATC3 but decrease to
    15·1 answer
  • Which process made making copies of technical drawings easier?
    8·1 answer
  • 2. (Problem 4.60 on main book, diameters different) Water flows steadily through a fire hose and nozzle. The hose is 35 mm diame
    8·1 answer
  • Which of the following is a Dashboard Scoreboard for alignment of the business where information is constantly flowing through t
    5·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!