for (int i = 0; i < name.length; i++) {
if (name[i].equals(null)) {
System.out.print("用户名:");
name[i]=input.next();
break;
}else{
continue;
}
}
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.HashMap;
public class Client {
public static void main(String[] args) throws Exception {
launch();
}
public static void launch() throws Exception {
boolean exit = false;
Map<String,User> reg = new HashMap<String,User>();
while(!exit) {
System.out.println("****欢迎进入奖客富翁系统*****");
System.out.println(" 1.注册");
System.out.println(" 2.登陆");
System.out.println(" 3.抽奖");
System.out.println("****************************");
System.out.print("请选择菜单:");
BufferedReader read = new BufferedReader(new InputStreamReader(System.in));
String option = read.readLine();
option = option.replaceAll(" "3".equals(option)) {
if("1".equals(option)) {
register(reg);
} else if("2".equals(option)) {
login(reg);
} else {
lottery();
}
}
System.out.print("继续吗?(y/n):");
read = new BufferedReader(new InputStreamReader(System.in));
option = read.readLine();
option = option.replaceAll(" \t", "");
if("y".equals(option)) {
System.out.println();
System.out.println();
} else {
System.out.println("系统推出,谢谢使用!");
exit = true;
}
}
}
private static void register(Map<String,User> reg) throws Exception {
String username = "";
String password = "";
String cardno = "";
System.out.println("[奖客富翁系统 > 注册]");
System.out.println("请填写个人注册信息");
System.out.print("用户名:");
BufferedReader strin = new BufferedReader(new InputStreamReader(System.in));
username = strin.readLine();
username = username.replaceAll("
------解决方案--------------------------------------------------------\t", "");
System.out.println();
if("1".equals(option) 这程序写到这样够啦 不用再深入,没多大作用,等你之后学了对象和类概念,再来把这个重写 "2".equals(option) 楼主的代码完全就是过程编程,毫无面向对象的思想在里面