这就是我到目前为止所拥有的,我该如何制作,以便他们有一个文本字段来输入区号,然后一个“确定”按钮进行确认,然后另一个文本区域将是结果?你推荐在 Eclipse 中使用 Visual Basic 或 WindowsBuilder 吗?
import java.util.Scanner;
public class AreaCode {
static int Miami = 786;
int Miamis = 897;
String str = Integer.toString(Miamis);
public static void main(String [] args) {
double areacode = 0;
String city = String.valueOf(areacode);
Scanner scan = new Scanner(System.in);
System.out.print("What is the area code?: ");
areacode = scan.nextDouble();
if (areacode == 786) {
System.out.print("This area code is from Miami");
}
else
if (areacode == 897)
{
System.out.print("This area code is from Chicago");
}
if (areacode == 911) {
System.out.print("This area code is from Police");
}
else
{
System.out.println("Not recognized");
}
}
}