Hi Im Can有人能帮助我完成我的程序吗? 我的教授要求我们做一个程序,它会从用户那里获取信息,并从用户的姓氏和名字中生成一个6个字母的用户名。 用户名的前3个字母是名字的前3个字母,其他3个是用户姓氏的最后3个字母。我们需要通过登录模块 来测试它,以测试用户名和密码是否与生成的用户名和用户输入的密码相匹配使用用户提供的信息生成用户名
只要我做了我无法找到答案,我们的教授didn'不要告诉我们这件事,我现在正在努力挣扎。
这是我的计划,现在>>>
public static InputStreamReader r = new InputStreamReader(System.in);
public static BufferedReader i = new BufferedReader(r);
public static void main(String[]args) throws Exception{
String Lname,Fname,Mi;
int age,bday;
float pass;
System.out.print("Enter Last Name: ");
Lname=i.readLine();
System.out.print("Enter First Name: ");
Fname=i.readLine();
System.out.print("Enter Middle Name: ");
Mi=i.readLine();
System.out.print("Age: ");
age=Integer.parseInt(i.readLine());
System.out.print("Birthday (MM/DD/YY) :");
bday=Integer.parseInt(i.readLine());
System.out.println("Password Must Be A 4-6 Digit Combination");
System.out.print("Enter Password : ");
pass=Float.parseFloat(i.readLine());
System.out.println("Please Wait While Generating Your UserName");
for(int j=0;j<=35;j++)
{
try{
Thread.sleep(100);
}
catch(InterruptedException ex)
{
//do nothing
}
System.out.print("*");
}
}
有人可以帮我请....
看看[substring](http://docs.oracle.com/javase/7/docs/api/) –