Question: Intro to Java Programming For this exercise, we will create the SequenceReader program and hand in SequenceReader.java. The purpose of SequenceReader is to allow the

Intro to Java Programming

For this exercise, we will create the SequenceReader program and hand in SequenceReader.java. The purpose of SequenceReader is to allow the user to enter the name and length of an alphabet, the alphabet, and then a sequence of alphabet symbols terminated by an empty line. A sample is shown below:

To create SequenceReader, code and test the following incrementally:

  1. A void method readAlphabet() that allows the user to enter the name, length, and symbols for an alphabet. (Since we don't know arrays yet, we won't bother to store the symbols. Extra credit is available if you do use an array of Strings to store the symbols.)
  2. A value method readSequence() that allows the user to enter a sequence of arbitrary length, one symbol at a time. After the user has entered a symbol, the program will ask the user if they would like to enter another symbol. The user may enter yes or no in response to that question, and the program will act accordingly. The method should return the length of the sequence entered by the user. Make sure you understand this is a value method returning an int!

Note that both methods require loops, and that the optimal choice of which kind of loop is different for each method.

Intro to Java Programming For this exercise, we will create the SequenceReader

Some sample output from a run of my program: What is the name of the sequence alphabet? RNA How many "letters" are in the sequence alphabet for RNA? 4 What is the next letter in RNA? A What is the next letter in RNA? C What is the next letter in RNA? G What is the next letter in RNA? U Please enter a sequence with one element per line Will you enter another element? (yeso) yes Will you enter another element? (yeso) yes Will you enter another element? (yeso) yes Will you enter another element? (yeso) no Thank you. The sequence is 4 items long

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!