当前位置: 代码迷 >> Eclipse >> 求生日的正则表达式,非百度搜的,解决思路
  详细解决方案

求生日的正则表达式,非百度搜的,解决思路

热度:85   发布时间:2016-04-23 14:01:01.0
求生日的正则表达式,非百度搜的,急
谢谢,明天要交的作业


import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.regex.Matcher;
import java.util.regex.Pattern;

public class yuangong {
String name, sex, birthday, telephone, email, enducation;
int pay;
BufferedReader bin = new BufferedReader(new InputStreamReader(System.in));

public yuangong(String aname, String asex, String abirthday,
String atelephone, String aemail, String aenducation, int apay) {
name = aname;
sex = asex;
birthday = abirthday;
telephone = atelephone;
email = aemail;
enducation = aenducation;
pay = apay;
}

public void nameInput() {// 姓名的输入
try {
String N=new String();
boolean b=true;
while(b){
N = bin.readLine();
if(!isNameNumericRegex(N)){
System.out.println("格式错误!");
continue;
}
else{
b=false;

}
}
}catch (IOException e) {
e.printStackTrace();

}
}

void sexTnput() {// 性别的输入
try {
String s=new String();
boolean b=true;
while(b){
s = bin.readLine();
if(!isSexNumericRegex(s)){
System.out.println("格式错误!请输入男或女");
continue;
}
else{
b=false;
}
}
} catch (IOException e) {
e.printStackTrace();
}
}

void birthdayInput() {// 生日的输入
try {
String bir=new String();
boolean b=true;
while(b){
bir=bin.readLine();
if(!BirthdayNumberiRecgex(bir)){
System.out.println("格式错误!");
continue;
}
else{

b=false;
}
}
} catch (IOException e1) {
e1.printStackTrace();
}
}

/*private boolean BirthdayNumberiRecgex(String bir) {
// TODO Auto-generated method stub
return false;
}

private boolean BirthdayNumberiRecgex(String bier) {
// TODO Auto-generated method stub
return false;
}
*/
void telephoneInput() {// 电话的输入
try {
Integer tel=new Integer(pay);
boolean b=true;
while(b){
tel = Integer.parseInt(bin.readLine());
if(!isTelNumericRegex(tel)){
System.out.println("格式输入错误!请重新输入");
}
else{
b=false;
}
}
} catch (IOException e) {
e.printStackTrace();
}
}

void emailInput() {// 邮箱的输入
try {
String e=new String();
boolean b=true;
while(b){
if(!isEmailNumericRegex(e)){
System.out.println("格式错误!请重新输入");
continue;
}
else{
email = bin.readLine();
b=false;
}
}
} catch (IOException e) {
e.printStackTrace();
}
}

void enducationInput() {// 学历的输入
try {
String endu=new String();
boolean b=true;
while(b){
if(!isEduNumericRegex(endu)){
System.out.println("格式错误!请重新输入");
continue;
}
else{
enducation = bin.readLine();
b=false; 
}
}
} catch (IOException e) {
e.printStackTrace();
}
}

private boolean isEduNumericRegex(String endu) {
// TODO Auto-generated method stub
return false;
}

void payInput() {//工资的输入
try {
Integer pay=new Integer(0);
boolean b=true;
while(b){
pay = Integer.parseInt(bin.readLine());
if(!isPayNumericRegex(pay)){
System.out.println("格式错误!请重新输入");
continue;
}
else{
b=false;
}

}catch (IOException e) {
e.printStackTrace();