package java15;
import java.util.Scanner;
public class Demo6 {
public static void main(String[] args) {
boolean fileCorrect=false;
boolean emailCorrect=false;
System.out.println("***欢迎进入作业提交系统***");
Scanner input=new Scanner (System.in);
System.out.println("请输入java的文件名:");
String name=input.next();
System.out.println("请输入您的邮箱:");
String email=input.next();
//检查java文件名
int index=name.lastIndexOf(".");
if(index!=-1 && index!=0 && name.substring(index+1,name.length()).equals("java")) {
fileCorrect=true;
}else {
System.out.println("文件名无效");
}
//检查您的邮箱
if(email.indexOf('@')!=-1 && email.indexOf(".")>email.indexOf('@')) {
emailCorrect=true;
}else {
System.out.println("您的E-mail无效!");
}
//检查结果
if(fileCorrect && emailCorrect) {
System.out.println("作业提交成功!");
}else {
System.out.println("作业提交失败!!");
}
}
}