I have written the below program for a homework and am really stuggling to find out how to do the email verification. Could anyone please help? (I have looked online and in the text book).
Thanks so much.
program DataInput;
uses
Classes,
SysUtils,
crt;
var
sname: string[15];
fname: string[15];
Height: real;
salary: currency;
gender: char;
tel: string;
email: string;
veg: char;
begin
writeln('This is a verification software');
sleep(1000);
clrscr;
writeln('Please enter your surname');
writeln;
readln(sname);
sleep(500);
clrscr;
writeln(' Surname: ', sname);
writeln('---------------------------------------------------------------------');
writeln;
writeln('Please enter your First name');
writeln;
readln(fname);
sleep(500);
clrscr;
writeln;
writeln(' First Name: ', fname);
writeln(' Surname: ', sname);
writeln('---------------------------------------------------------------------');
writeln;
writeln('Please enter your height in cm');
writeln;
readln(Height);
sleep(500);
clrscr;
writeln(' First Name: ', fname);
writeln(' Surname: ', sname);
writeln(' Height: ', Height: 0: 2, 'cm');
writeln('---------------------------------------------------------------------');
writeln;
writeln('Please enter your salary (in GBP per annum) - please do not use symbols');
writeln;
readln(Salary);
sleep(500);
clrscr;
writeln(' First Name: ', fname, '');
writeln(' Surname: ', sname, '');
writeln(' Height: ', Height: 0: 2, 'cm');
writeln(' Salary: ', chr(156), Salary: 0: 2);
writeln('---------------------------------------------------------------------');
writeln;
writeln('Please enter your gender, either ''m''(male) or ''f''(female) ');
writeln;
readln(gender);
sleep(500);
clrscr;
writeln(' First Name: ', fname, '');
writeln(' Surname: ', sname, '');
writeln(' Height: ', Height: 0: 2, 'cm');
writeln(' Salary: ', chr(156), Salary: 0: 2);
if upcase(gender) = 'M' then
writeln(' Gender: Male')
else
writeln(' Gender: Female');
writeln('---------------------------------------------------------------------');
sleep(500);
repeat
writeln('Please enter your home phone number - no spaces please i.e. 01234567890');
writeln;
readln(tel);
until (Length(tel) = 11) or (Length(tel) = 14);
sleep(500);
clrscr;
writeln(' First Name: ', fname, '');
writeln(' Surname: ', sname, '');
writeln(' Height: ', Height: 0: 2, 'cm');
writeln(' Salary: ', chr(156), Salary: 0: 2);
if upcase(gender) = 'M' then
writeln(' Gender: Male')
else
writeln(' Gender: Female');
writeln(' Telephone: ', tel);
writeln('---------------------------------------------------------------------');
sleep(500);
clrscr;
writeln('Please enter your email address. It must contain an @ symbol and not contain:');
writeln(' /');
sleep(400);
writeln(' <');
sleep(400);
writeln(' >');
writeln(' \');
sleep(400);
writeln(' ,');
sleep(400);
writeln(' ;');
readln(email);
//Require a method to validate the email address.
sleep(500);
clrscr;
writeln(' First Name: ', fname, '');
writeln(' Surname: ', sname, '');
writeln(' Height: ', Height: 0: 2, 'cm');
writeln(' Salary: ', chr(156), Salary: 0: 2);
if upcase(gender) = 'M' then
writeln(' Gender: Male')
else
writeln(' Gender: Female');
writeln(' Telephone: ', tel);
writeln(' Email: ', email);
writeln('---------------------------------------------------------------------');
sleep(500);
writeln;
writeln('Are you a vegetarian? Enter y/n (yes/no) ');
writeln;
readln(veg);
sleep(500);
clrscr;
writeln(' First Name: ', fname, '');
writeln(' Surname: ', sname, '');
writeln(' Height: ', Height: 0: 2, 'cm');
writeln(' Salary: ', chr(156), Salary: 0: 2);
if upcase(gender) = 'M' then
writeln(' Gender: Male')
else
writeln(' Gender: Female');
writeln(' Telephone: ', tel);
writeln(' Email: ', email);
if upcase(veg) = 'Y' then
writeln(' Vegetarian: Yes')
else
writeln(' Vegetarian: No');
writeln('---------------------------------------------------------------------');
sleep(500);
readln;
end.