-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathConsoleUI.java
More file actions
68 lines (55 loc) · 2.35 KB
/
Copy pathConsoleUI.java
File metadata and controls
68 lines (55 loc) · 2.35 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
import java.util.Scanner;
public class ConsoleUI {
Scanner input = new Scanner(System.in);
public String getSequence(SequenceManager SM){
System.out.println("Kindly enter the DNA/RNA sequence:");
String sequenceToCheck = input.nextLine();
boolean isValid = SM.isValidSequence(sequenceToCheck); // Pass the original input here
if(!isValid){ // Simplified check
while (true) {
System.out.println("Enter a valid input please");
sequenceToCheck = input.nextLine();
isValid = SM.isValidSequence(sequenceToCheck);
if(isValid){
break;
}
}
}
return sequenceToCheck.toUpperCase();
}
public void printRNAORDNA(String inputSequence, boolean isDNA){
if(isDNA == true){
System.out.println("The sequence you entered is of type DNA");
}else {
System.out.println("The sequence you entered is of type RNA");
}
}
public void printProteinDNA(String[] mRNAStrandOne, String[] mRNAStrandTwo){
System.out.println("5'3' Frame 1: " + mRNAStrandOne[0]);
System.out.println("5'3' Frame 2: " + mRNAStrandOne[1]);
System.out.println("5'3' Frame 3: " + mRNAStrandOne[2]);
System.out.println("3'5' Frame 1: " + mRNAStrandTwo[0]);
System.out.println("3'5' Frame 2: " + mRNAStrandTwo[1]);
System.out.println("3'5' Frame 3: " + mRNAStrandTwo[2]);
}
public void printProteinmRNA(String[] mRNAStrandOne){
System.out.println("5'3' Frame 1: " + mRNAStrandOne[0]);
System.out.println("5'3' Frame 2: " + mRNAStrandOne[1]);
System.out.println("5'3' Frame 3: " + mRNAStrandOne[2]);
}
public void printDNAStrands(String DNA, String antiDNA){
if(antiDNA==null){
System.out.println("RNA Strand:\t5'-"+DNA+"-3'");
}else{
System.out.println("Strand 1:\t5'-"+DNA+"-3'");
System.out.println("Strand 2 (Reverse Complement):\t5'-"+antiDNA+"-3'");
}
}
public void printmRNAForm(String StrandOne, String StrandTwo){
if(StrandTwo!=null){
System.out.println("Converting both DNA strands to mRNA");
System.out.println("Strand 1:\t5'-"+StrandOne+"-3'");
System.out.println("Strand 2:\t5'-"+StrandTwo+"-3");
}
}
}