-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathaadict.java
More file actions
94 lines (91 loc) · 1.83 KB
/
Copy pathaadict.java
File metadata and controls
94 lines (91 loc) · 1.83 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
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
import java.util.Scanner;
class aadict
{
public static void main (String args[]) throws Exception
{
System.out.println("Enter the amino acid code : ");
char one_letter_code = (char)System.in.read();
boolean validation;
aadict a = new aadict();
validation = a.validate(one_letter_code);
if(validation)
a.code(one_letter_code);
else
System.out.println("Invalid amino acid single-letter code.");
}
void code(char x)
{
switch(x)
{
case 'A':
System.out.println("Alanine.");
break;
case 'C':
System.out.println("Cysteine.");
break;
case 'D':
System.out.println("Aspartate.");
break;
case 'E':
System.out.println("Glutamate.");
break;
case 'F':
System.out.println("Phenylalanine.");
break;
case 'G':
System.out.println("Glycine.");
break;
case 'H':
System.out.println("Histidine.");
break;
case 'I':
System.out.println("Isoleucine.");
break;
case 'K':
System.out.println("Lysine.");
break;
case 'L':
System.out.println("Leucine.");
break;
case 'M':
System.out.println("Methionine.");
break;
case 'N':
System.out.println("Asparagine.");
break;
case 'P':
System.out.println("Proline.");
break;
case 'R':
System.out.println("Arginine.");
break;
case 'S':
System.out.println("Serine.");
break;
case 'T':
System.out.println("Threonine.");
break;
case 'V':
System.out.println("Valine.");
break;
case 'W':
System.out.println("Tryptophan.");
break;
case 'Y':
System.out.println("Tyrosine.");
break;
case 'Q':
System.out.println("Glutamine.");
break;
default:
break;
}
}
boolean validate(char x)
{
if (x == 'B' || x == 'J' || x == 'O' || x == 'U' || x == 'X' || x == 'Z')
return false;
else
return true;
}
}