-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathASCII.java
55 lines (45 loc) · 1.3 KB
/
ASCII.java
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
//American Standard Code for Information Interchange (ASCII)
/*
*@EskandarAtrakchi
*/
import java.util.Scanner;
class Micc1 {
static String struserInput;
public static void main(String[] args) {
actual();
Main();
exit();
info();
}
public static void actual() {
Scanner y = new Scanner (System.in);
System.out.println("Select number 1 to choose an Alphabet\nor number 2 to exit");
while(true) {
try {//This might needed to be moved somewhere else
}
catch (Exception e) {
System.out.println("Something went wrong! please, choose again ");
}
int x = y.nextInt();
switch(x) {
case 1 :
Main();System.out.println("You can select another Alphbet or select number 2 to exit the system ");break;
case 2 : System.out.println("The system is shutted down"); exit();break;
default : System.out.println("Please try again "); actual();
}
}
}
public static void Main() {
System.out.println("Please enter the Alphabet");
Scanner scanner = new Scanner (System.in);
char ch = scanner.next().charAt(0);
int ASCII = ch;
System.out.println("The value of " + ch + " is " + ASCII);
}
public static void exit() {
System.exit(0);
}
public static void info() {
System.out.println("Wrong input!");
}
}