Computer Programming I :: Projects :: DNA to RNA
Department Connection: Science
Problem
A strand of DNA is composed of adenine, thymine, cytosine, and guanine. RNA is composed of three of the same compounds, but thymine is replaced by uracil. These compounds are represented by the letters A, T, C, G, and U.
Given a string of DNA entered into a textbox, show the RNA sequence with any instances of T replaced with the letter U.
Specific Requirements
- You will need a while loop to go through the string of text.
- Use the substring method to look at each letter of the string.
- You should create a variable that starts empty, but gradually fills with letters from the string or the letter U.
- Test out your program with the string GATGGAACTTGACTACGTAAATT. It should output GAUGGAACUUGACUACGUAAAUU.
- Determine a good name for each variable following the rules.
- Rename the form and all controls on the form using a three-letter prefix.
- Add a comment header following class guidelines.
Tips
- Remember that the first letter in a string is location (index) 0.
- Use the += command to add letters to your output string.