68 291
Assignments Done
99%
Successfully Done
In November 2018

Answer to Question #4821 in Java | JSP | JSF for Nick

Question #4821
Java

Anyone know how to make a Switch statement to ask the user for a number and then convert it to a single Chinese character and print it out?



I just need a small example so I can get started. So far I got the unicode for Chinese characters.

4E8C = 1 in chinese
4E09 = 2
Expert's answer
import java.util.Scanner;

public class Test {

public static
void main(String[] args) {
Scanner in = new
Scanner(System.in);
String usersChoise = in.next();
char
result = ' ';
switch (usersChoise.charAt(0)) {
case
'1':
result = 0x4E8C;
break;
case
'2':
result = 0x4E09;
break;
}

System.out.println(Character.toString(result));
}
}

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be first!

Leave a comment

Ask Your question

Submit
Privacy policy Terms and Conditions