Matthew+Mordeson

Final Project

import java.util.Scanner;

public class baseIdentifier {

public static void main(String[] args) {

/* Starts the program. */

System.out.println("This program identifies the amino acids");

System.out.println("that a given set of nitrogen bases will produce.");

System.out.println("");

System.out.println("Please enter a three-digit sequence from the leading 3' - 5'");

System.out.println(" strand, of A's, T's, G's, and C's. Press q to quit.");

System.out.println("");

String[] codon = new String[64];

/* Creates a matrix for which we can assign values for multiple inputted strings. */

codon[0] = "AAA";

codon[1] = "AAT";

codon[2] = "AAG";

codon[3] = "AAC";

codon[4] = "ATA";

codon[5] = "ATT";

codon[6] = "ATG";

codon[7] = "ATC";

codon[8] = "AGA";

codon[9] = "AGT";

codon[10] = "AGG";

codon[11] = "AGC";

codon[12] = "ACA";

codon[13] = "ACT";

codon[14] = "ACG";

codon[15] = "ACC";

codon[16] = "TAA";

codon[17] = "TAT";

codon[18] = "TAG";

codon[19] = "TAC";

codon[20] = "TTA";

codon[21] = "TTT";

codon[22] = "TTG";

codon[23] = "TTC";

codon[24] = "TGA";

codon[25] = "TGT";

codon[26] = "TGG";

codon[27] = "TGC";

codon[28] = "TCA";

codon[29] = "TCT";

codon[30] = "TCG";

codon[31] = "TCC";

codon[32] = "GAA";

codon[33] = "GAT";

codon[34] = "GAG";

codon[35] = "GAC";

codon[36] = "GTA";

codon[37] = "GTT";

codon[38] = "GTG";

codon[39] = "GTC";

codon[40] = "GGA";

codon[41] = "GGT";

codon[42] = "GGG";

codon[43] = "GGC";

codon[44] = "GCA";

codon[45] = "GCT";

codon[46] = "GCG";

codon[47] = "GCC";

codon[48] = "CAA";

codon[49] = "CAT";

codon[50] = "CAG";

codon[51] = "CAC";

codon[52] = "CTA";

codon[53] = "CTT";

codon[54] = "CTG";

codon[55] = "CTC";

codon[56] = "CGA";

codon[57] = "CGT";

codon[58] = "CGG";

codon[59] = "CGC";

codon[60] = "CCA";

codon[61] = "CCT";

codon[62] = "CCG";

codon[63] = "CCC";

String[] aminoAcid = {"phenylalanine", "leucine", "phenylalanine", "leucine", "tyrosine", "STOP PRODUCTION", "tyrosine", "STOP PRODUCTION", "serine", "serine", "serine", "serine", "cysteine", "STOP PRODUCTION", "cysteine", "tryptophan", "leucine", "leucine", "leucine", "leucine", "histidine", "glutamine", "histidine", "glutamine", "proline", "proline", "proline", "proline", "arginine", "arginine", "arginine", "arginine", "isoleucine", "isoleucine", "isoleucine", "METHIONINE (START PRODUCTION)", "asparagine", "lysine", "asparagine", "lysine", "threonine", "threonine", "threonine", "threonine", "serine", "arginine", "serine", "arginine", "valine", "valine", "valine", "valine", "aspartate", "glutamate", "aspartate", "glutamate", "alanine", "alanine", "alanine", "alanine", "glycine", "glycine", "glycine", "glycine"};

/* Provides a matrix that we can overlay over the first, so that the values in the first correspond with the values in the second. */

Scanner in = new Scanner(System.in);

boolean done = false;

String userInput;

String inputCollection = " ";

String result = "";

int count = 0;

/* Defines the String type, boolean type, and int type variables, and introduces the scanner system from Java 5. */

while (!done)

{

userInput = in.nextLine;

if (userInput.equalsIgnoreCase("Q")) done = true;

count = 0;

while (count < 64 && !done)

{

if (codon[count].equalsIgnoreCase (userInput))

{

result = result + aminoAcid[count] + " ";

inputCollection = inputCollection + userInput + " ";

System.out.println("Your codon sequence was " + inputCollection + ". The corresponding amino acid sequence is " + result + ".");

count = 65;

System.out.println("Enter another codon or enter q to quit.");

}

count = count + 1;

}

if (count == 64)

System.out.println("Invalid response, you FOOL!");

}

/* Generates the appropriate response for the user's input. The previous responses are compounded. The q button is introduced as a method of stopping the program. */

}

}

In 2012, radioactive yams will rule the earth