I want to stress that I know how to solve this this problem if only I could modify the code that my instructor has given me, but that is not an option. I should also stress that I don't have very much experience with Java.
So I have been given this assignment to complete a project where the skeleton code is provided for me. This is the output I am getting from running it:
Genomic sequence: [C@4aa298b7
Sequence length: 25
Array of exon positions: [1, 5, 8, 10, 13, 16]
As you can see, the "Genomic sequence" field is printing a pointer instead of valid data which should look more like "AAAGGTTATTA..."
This is where the information is printed out:
public class BioSeqData
{
public static void main(String[] args)
{
String demodna = new String("AATGCCAGTCAGCATAGCGTAGACT");
int[] ardemo = {1, 5, 8, 10, 13, 16};
GenomicDNASequence gdemo = new GenomicDNASequence(demodna.toCharArray());
System.out.println( "Genomic sequence: " + gdemo );
...
If I could modify this class in the assignment to print out what the pointer is pointing to instead of the pointer itself, I would, but that is not an option. How can I change GenomicDNASequence to return the char array instead of a pointer?
Here are the relevant parts of Genomic DNA Sequence:
public class GenomicDNASequence extends DNASequence
{
public boolean[] iscoding; // made public instead of private for grading.
public GenomicDNASequence(char[] gdnaarr)
{
super(gdnaarr);
}
...
And the class that it extends:
public class DNASequence extends Sequence
{
public DNASequence(char[] dnaarr)
{
super(dnaarr);
}
...
And the class that that extends:
public class Sequence
{
public char[] seqarr; // made public instead of protected for grading.
public Sequence(char[] sarr)
{
for(int i=0;i<sarr.length;i++){
if (!isValidLetter(sarr[i])){
throw new IllegalArgumentException("Invalid sequence of letters for class edu.iastate.cs228.hw1.Sequence");
}
}
seqarr=sarr;
...