第十五章

(1package shiwushangjilianxi;

import java.util.Scanner;

public class shiwushangji_2 {
    String[] word=new String[2];
    String shen;
    String ji;
    String zhu;
   
    public boolean show(){
         boolean con = false;
         String word[]=zhu.split("-");
        if(shen.length()>=16&&(shen.length()<=18)){
            con=true;
        }else{
            System.out.println("身份证必须是16位或18位!");
            con = false;
        }
        if(ji.length()==11){
            con=true;
        }else{
            System.out.println("手机必须是11位!");
            con = false;
        }
       if(word[0].length()==4 && (word[1].length()==7)){
            con=true;
          }else{
           System.out.println("座机号码区号必须为4位,电话号码必须为7位!");
           con = false;
        }
        if ((shen.length() >= 16&&shen.length()<=18 ) && ji.length()==11
          && word[0].length()==4 && ( word[1].length()==7)){
            System.out.println("注册成功!");
            con=true;
        }else{
            con = false;
        }
        return con;
    }
    public static void main(String[] args) {
        shiwushangji_2  a = new shiwushangji_2();
    Scanner input = new Scanner(System.in);
    boolean flag=false;
    System.out.println("***欢迎进入注册系统***");
    System.out.println("");
    do{
    System.out.println("请输入身份证号:");
    a. shen = input.next();
    System.out.println("请输入手机号:");
    a. ji = input.next();
    System.out.println("请输入座机号:");
    a. zhu = input.next();
    
     boolean show = a.show();
    
     if(show==true){
         flag=true;
     }
     
    }while (flag==false);
    }
}

 

转载于:https://www.cnblogs.com/1402380606HZ/p/7401039.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值