您的位置:首页 > 其它

实现会员注册升级

2016-09-20 17:25 225 查看
public class demo17 {
public boolean verify(String pwd,String pwd1,String phone){
Boolean con=false;
String[] splitphone=new String[3];
splitphone=phone.split("-",2);
if(pwd.length()!=16&&pwd.length()!=18){
System.out.println("身份证号必须是16位或18位");
}else if(pwd1.length()!=11){
System.out.println("手机号必须是11位");
}else if(splitphone[0].length()!=4 && splitphone[0].length()!=7){
System.out.println("座机号码区号必须是4位,电话号码必须是7位");
}else{
System.out.println("注册成功");
con=true;
}
return con;

}
}

import java.util.Scanner;

public class text17 {
public static void main(String[] args) {
Scanner input =new Scanner(System.in);
demo17 a=new demo17();
String pwd,pwd1,phone;
Boolean con=false;
do{
System.out.println("******欢迎进入注册系统*******");
System.out.println("请输入身份证号:");
pwd=input.next();
System.out.println("请输入手机号:");
pwd1=input.next();
System.out.println("请输入座机号:");
phone=input.next();
con=a.verify(pwd,pwd1,phone);
System.out.println(con);
}while(!con);

}
}
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: