ITI0011-2015:harjutus 03

Allikas: Kursused
Redaktsioon seisuga 12. veebruar 2015, kell 01:36 kasutajalt Ago (arutelu | kaastöö) (Uus lehekülg: '<source lang="java"> →‎* * Home assignment 03. * * Read more: https://courses.cs.ttu.ee/pages/ITI0011:harjutus_03: public class Task03 { /** * Given a string, check wh...')
(erin) ←Vanem redaktsioon | Viimane redaktsiooni (erin) | Uuem redaktsioon→ (erin)
Mine navigeerimisribale Mine otsikasti

<source lang="java"> /**

* Home assignment 03.
* 
* Read more: https://courses.cs.ttu.ee/pages/ITI0011:harjutus_03
*/

public class Task03 {

/** * Given a string, check whether it represents a valid * DNA sequence, e.g. it contains only A, C, G, T characters. * @param sequence Possible DNA sequence. * @return Whether the given sequence is a valid DNA sequence. */ public static boolean isValidDnaSequence(String sequence) { return true; }

/** * Given a string, find what is the highest * occurrence of one nucleotide base (A, C, G, or T). * @param dnaSequence Possible DNA sequence. * @return The number representing how many times the most * frequent nucleotide base occurs in the string. In case * the input sequence is not a valid DNA sequence, returns -1. */ public static int highestOccurrence(String dnaSequence) { return 0; }

/** * Given a possible DNA string, transcribe it to RNA. * In the transcription process, you have to do the * following substitutions: * A -> U, G -> C, C -> G, T -> A * @param dnaSequence Possible DNA sequence. * @return Transcribed RNA. In case the input sequence * is not a valid DNA sequence, returns null. */ public static String transcribe(String dnaSequence) { return ""; }

/** * Given a possible DNA string, transcribe it to RNA * and then translate RNA to protein sequence. * @param dnaSequence Possible DNA sequence. * @return Translated protein sequence. In case the input * sequence is not a valid DNA sequence, returns null. */ public static String translateProtein(String dnaSequence) { return ""; }

/** * The main method, which is the entry point of the program. * !!IMPORTANT!! You have to keep the main method in order * to get your solution tested. * @param args Arguments from the command line */ public static void main(String[] args) { System.out.println(isValidDnaSequence("ACTGT")); // => true System.out.println(highestOccurrence("AACT")); // => 2 System.out.println(transcribe("ACAGCT")); // => UGUCGA System.out.println(translateProtein("ACAGCT")); // => CR

}

}

</source>