Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import javax.swing.*;
- import java.util.regex.Matcher;
- import java.util.regex.Pattern;
- public class EmailAndGrade
- {
- public static void main(String[] args)
- {
- //Variables
- String sEmail, sError, sTest;
- int iTest;
- char cGrade;
- sEmail = JOptionPane.showInputDialog("Enter your email: ");
- private static boolean validEmail(String[] sEmail)
- {
- // editing to make requirements listed
- // return email.matches("[A-Z0-9._%+-]+@[A-Z0-9.-]+\\.[A-Z]{2,4}");
- return email.matches("[A-Z0-9]{7}+@[springfieldcollege]+\\.[edu]");
- }
- sError = "One or More Errors with the Input Email.\n
- Email is Empty.\n
- Email must be less than 30 characters.\n
- Must end in: @springfieldcollege.edu.\n
- Can only have one @.\n
- Must start with A through Z or a through z.\n
- Can not have: # $ % & ,\n";
- sTest = JOptionPane.showInptDialog("Enter Test Grade: ");
- iTest = Integer.parseInt(sTest);
- }
- /*
- void checkEmails()
- {
- for(String email : emailAddresses) {
- if(validEmail(email)) {
- // it's a good email - do something good with it
- }
- else {
- // it's a bad email - do something... bad to it? sounds dirty...
- JOptionPane.showMessageDialog(null,
- sError,
- "Email Error - Killian O'Brien",
- JOptionPane.INFORMATION_MESSAGE);
- }
- }*/
- System.exit{0};
- }
Advertisement
Add Comment
Please, Sign In to add comment