// 会员注册类
public class LoginDemo {
private String name;
private String sex;
private int age;
// 会员注册
public LoginDemo(String name, String sex, int age) {
this.name = name;
this.sex = sex;
this.age = age;
}
// 显示会员注册后的信息
public void show(){
System.out.println("创建会员成功");
Random random=new Random();
for(int i=0;i<4;i++){
int ran=(random.nextInt(9))+1;
System.out.print(ran);
}
System.out.println("\n会员详细信息:\n"+this.name+"\t"+this.sex+"\t"+this.age);
}
}
public static void main(String[] args){
Scanner scan = new Scanner(System.in);
System.out.println("请输入会员姓名");
String name = scan.next();
System.out.println("请输入会员性别");
String sex = scan.next();
System.out.println("请输入会员年龄");
int age = scan.nextInt();
scan.close();
// 一个注册用户对象
LoginDemo vip=new LoginDemo(name, sex, age);
vip.show();
}
创建会员账号
最新推荐文章于 2023-10-27 16:06:44 发布