package Dome15;
import java.util.Scanner;
public class Vip {
boolean flag = false;
Scanner x = new Scanner(System.in);
public void birthday() {
String date = "";
do {
System.out.println("请输入会员生日<月/日:00/00>:");
date = x.next();
if (date.indexOf('/') == 2 && date.length() == 5) {
System.out.println("该会员生日是" + date);
flag = true;
} else {
System.out.println("生日形式错误");
flag = false;
}
} while (flag == false);
}
public void password() {
do {
System.out.println("请输入会员密码<6~10位>:");
int password = x.nextInt();
if (999999 < password && password < 1000000000) {
System.out.println("该会员的密码是" + password);
flag = true;
} else {
System.out.println("密码形式错误");
flag = false;
}
} while (!flag);
}
public static void main(String[] args) {
Vip v = new Vip();
v.birthday();
v.password();
}
}
13
最新推荐文章于 2024-06-04 11:05:11 发布