Question: - Also program should be written in C - Also a function should have a brief comment above its definition describing what it does. (70

- Also program should be written in C
- Also a function should have a brief comment above its definition describing what it does.
(70 points) A fashion retailer has decided to provide discount codes to teachers and students during a promotional event. The first step is to verify the teacher/student status of people requesting discount code by their email addresses. They will check if the email addresses end with .edu and find the domain name if it does before further verification. 1. Write a program to find the domain name of an email address if the domain name ends with edu. The program displays domain that ends with edu. If the input does not contain an email address that ends with.edu, the program should display a message that indicates it is not a valid email address for the discount code. Example input/output: Input: jennifer23@nyu.edu Output: nyu.edu Input: joew19email.usf.edu Output: mail.usf.edu Input: johnAfacebook.com Output Not a valid email address for the discountcode Your program should include the following function: int find_domain (char *sl, char *s2) The find_domain function expects s1 to point to a string containing the input for an email address as a string and stores the domain to the string pointed by s2. If the email address does no end with .edu, s2 should contain an empty string. An empty string is a valid string with no characte except the null character. The function returns 1 if the email addresses ends with .edu in the domain, and returns 0 otherwise. 1) Name your program email_address.c 2) 3) 4) Assume input is no longer than 1000 characters. Assume the input contains no more than one qualifying web address The find_domain function should use pointer arithmetic (instead of array subscripting). In other words, eliminate the loop index variables and all use of the [] operator in the function To read a line of text, use the read line function (the pointer version) in the lecture notes. (70 points) A fashion retailer has decided to provide discount codes to teachers and students during a promotional event. The first step is to verify the teacher/student status of people requesting discount code by their email addresses. They will check if the email addresses end with .edu and find the domain name if it does before further verification. 1. Write a program to find the domain name of an email address if the domain name ends with edu. The program displays domain that ends with edu. If the input does not contain an email address that ends with.edu, the program should display a message that indicates it is not a valid email address for the discount code. Example input/output: Input: jennifer23@nyu.edu Output: nyu.edu Input: joew19email.usf.edu Output: mail.usf.edu Input: johnAfacebook.com Output Not a valid email address for the discountcode Your program should include the following function: int find_domain (char *sl, char *s2) The find_domain function expects s1 to point to a string containing the input for an email address as a string and stores the domain to the string pointed by s2. If the email address does no end with .edu, s2 should contain an empty string. An empty string is a valid string with no characte except the null character. The function returns 1 if the email addresses ends with .edu in the domain, and returns 0 otherwise. 1) Name your program email_address.c 2) 3) 4) Assume input is no longer than 1000 characters. Assume the input contains no more than one qualifying web address The find_domain function should use pointer arithmetic (instead of array subscripting). In other words, eliminate the loop index variables and all use of the [] operator in the function To read a line of text, use the read line function (the pointer version) in the lecture notes
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
