this is my first time in this website, I'm not english so srry for my broken english, I started programming one or to months ago so srry if I say some dumb things. I'm trying to create a program in which you have to insert strings made by the letters AGTC, it will stop asking for strings when I insert a point. This program changes this letters (A for T, T for A, G for C and C for G), when the letters are changed it prints all the strings inverted, here i give an example:
input: ATGCATGC GTCGTGA . Output: GCATGCAT (inverted) TCACGAC (inverted)
The problem is in the last loop in whcih I want to print the string inverted. Pd: I'm trying to give the most info I can to make it easy for you it's mY first time, plz understand.
Scanner t = new Scanner(System.in);
String [] cad = new String [20]; //Strings which we are going to enter (made by AGTC..);
String [] fin = new String [20]; //Strings which I want to print
int [] length = new int [20]; //I took the lenght of ever string to change the letters from each one.
boolean [] ver = new boolean [20]; //This boolean is to stop the loop, when I type a point the loop must stop.
System.out.println("Put ADN chains (Finish with a point)");
int count = 0;
for (int i=0; i<20; i++) {
cad[i]=t.nextLine();
cad[i]=cad[i].toUpperCase();
length [i] = cad[i].length();
fin[i]=cad[i].replaceAll("T","a");
fin[i]=fin[i].replaceAll("A","t");
fin[i]=fin[i].replaceAll("G","c");
fin[i]=fin[i].replaceAll("C","g");
ver [i] = cad[i].equals("."); //The way the loop should stop.
if (ver[i]==true){
break;
}
if (ver[i]==false){
count++; //I made this counter only to know how many strings they have inserted.
}
}
for (int i=0;i<count; i++) {
for (int j=0;j<length[i]; i--) { //Here is the main problem, I got the chain with the letters changed but I need to invert the chain.
System.out.println(fin[i].toUpperCase());
}
}