码迷,mamicode.com
首页 > 其他好文 > 详细

第十五章

时间:2017-08-25 01:22:03      阅读:224      评论:0      收藏:0      [点我收藏+]

标签:ann   str   div   成功   style   int   put   ext   als   

(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);
    }
}

 

第十五章

标签:ann   str   div   成功   style   int   put   ext   als   

原文地址:http://www.cnblogs.com/1402380606HZ/p/7401039.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!