Answered step by step
Verified Expert Solution
Question
1 Approved Answer
u For problems 3-5, your solutions must use only the following methods from Java's String class. Do not use regular expressions if you happen to
u
For problems 3-5, your solutions must use only the following methods from Java's String class. Do not use regular expressions if you happen to be familiar with those that would cheapen the experience :) charAt(int i) indexOf(int targetChar) 1 indexOf(String targetString) length() split(String pattern) substring(int i) substring(int i, int j) toLowerCase(). toUpperCase() 5. (15 points) You've just been hired onto the IT staff at the Best University Ever (BUE). You're working on a website that collects student information, and you want to make sure that the email addresses they provide are valid university emails. BUE's emails are case-insensitive and in this format: [first initial]. [last name] [1 or more digits (optional)]@ [1 or more subdomains, each followed by a dot (optional)]bue.edu The first initial, last name, and subdomains (if present) cannot be blank, and they can contain only letters. Within a source file named EmailValidator.java, write the static method boolean isValidEmail(String s) This method returns whether s is a valid email address. Here are some examples of valid email addresses: t.stark@bue.edu T.stArK420@cs. bue.edu O. Prime@rigel.cs.bue.edu s.snape@darkarts. bue.edu Here are some examples of invalid email addresses: . slothlover@bue.edu Missing first initial j.j.abrams@bue.edu Too many "first initials jon. snow@bue.edu First "initial" is too many characters j.snow@memphis.edu Wrong university j.snow@bue.com No .edu domain - BUE is totally not commercial, or so they claim j.snow2stark@bue.edu Digits must be after the last name r.summers@cs2.bue.edu Subdomain contains a non-letter character r. summers@.bue.edu Blank subdomain x.xXx Sephiroth xXx@bue.edu Last name contains non-letter characters blargh What kind of excuse for an email address is this?? . For problems 3-5, your solutions must use only the following methods from Java's String class. Do not use regular expressions if you happen to be familiar with those that would cheapen the experience :) charAt(int i) indexOf(int targetChar) 1 indexOf(String targetString) length() split(String pattern) substring(int i) substring(int i, int j) toLowerCase(). toUpperCase() 5. (15 points) You've just been hired onto the IT staff at the Best University Ever (BUE). You're working on a website that collects student information, and you want to make sure that the email addresses they provide are valid university emails. BUE's emails are case-insensitive and in this format: [first initial]. [last name] [1 or more digits (optional)]@ [1 or more subdomains, each followed by a dot (optional)]bue.edu The first initial, last name, and subdomains (if present) cannot be blank, and they can contain only letters. Within a source file named EmailValidator.java, write the static method boolean isValidEmail(String s) This method returns whether s is a valid email address. Here are some examples of valid email addresses: t.stark@bue.edu T.stArK420@cs. bue.edu O. Prime@rigel.cs.bue.edu s.snape@darkarts. bue.edu Here are some examples of invalid email addresses: . slothlover@bue.edu Missing first initial j.j.abrams@bue.edu Too many "first initials jon. snow@bue.edu First "initial" is too many characters j.snow@memphis.edu Wrong university j.snow@bue.com No .edu domain - BUE is totally not commercial, or so they claim j.snow2stark@bue.edu Digits must be after the last name r.summers@cs2.bue.edu Subdomain contains a non-letter character r. summers@.bue.edu Blank subdomain x.xXx Sephiroth xXx@bue.edu Last name contains non-letter characters blargh What kind of excuse for an email address is thisStep by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started