第一本十五章上級2註冊賬號

package com.pp;

import java.util.Scanner;

public class kkk {
	/**
	 * @param args
	 */
	public static void main(String[] args) {
		boolean he=false;
		Scanner input = new Scanner(System.in);
		do{
		System.out.println("請輸入身份證號");
		String s = input.next();
		System.out.println("請輸入手機號");
		String shou = input.next();
		System.out.println("請輸入座機號");
		String z = input.next();
		String[] sh = z.split("-");
		if (s.length() != 16 && s.length() != 18) {
			System.out.println("身份證必須是16或18位");
		} else if (shou.length() != 11) {
			System.out.println("手機號必須是11位");
		} else if (sh[0].length() != 4 && sh[1].length() != 7) {
			System.out.println("座機區號是4位,號碼爲7位");
		} else {
			System.out.println("註冊成");
			he=true;
		}
		}while(!he);

	}

}

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章