title: finding an email in a text file and sorting the email information
body: <p>I have a text file that would supposedly look like this</p>
  
  <blockquote>
    <p>I am Hakan. My email address is hakan@cs.uh.edu, and what is your name? 
    Hi my name is Tarikul and my favorite email address is tarikul2000@uh.edu</p>
  </blockquote>
  
  <p>im supposed to create a program that will locate the emails in the file store the username,domaian, subdomain and extension then rewrite them int another text file.</p>
  
  <pre><code>import java.io.* ;
  import java.io.FileNotFoundException;
  import java.util.Scanner;
  import java.io.PrintWriter;
  import java.io.FileOutputStream;
  
  public class Try {
      public static void main(String[] args) {
          Email [] storage;// email is a class that was made to store the data
          try {
              Scanner input= new Scanner("inputemails.txt");
              PrintWriter output= new PrintWriter("outputemails.txt");
  
              }
  
           catch (FileNotFoundException e) {
              System.out.print("File not found");
              System.exit(0);}
          int i=0;
          while(input.hasNextLine()){
              if(input.contains("@"));
              {
                  storage[i]=
              }
          }
  
  
      }
  
  }
  </code></pre>
  
  <p>this is what i have so far , its not much but how would i get it to find the email in the text file?</p>
  
  <p>also i thought it be better if i added the actual instructions to my assignment, im not asking for anyone to do the entire progam jus how would i separate the data i need to find</p>
  
  <blockquote>
    <ol>
    <li>Connect to the external input file. The name of the input file will always be inputemails.txt, and
    therefore please don’t ask the file name in your program.</li>
    <li>Detect the email addresses in the file.</li>
    <li>If an email does not have a sub-domain, please create Email object for that email.</li>
    <li>If an email has a sub-domain, please create UniversityEmail object for that email.</li>
    <li>Please store all emails in the same (one single) array list.</li>
    <li>After you copy all emails from the file to the array list, please ask the user what type of emails to be
    included in the output file. If the user enters 0, please write the emails that do not have sub-domain in
    the array list. Please note that the output file must start with a number indicating the number of emails
    in the file. If the user enters a number between 1-7, please write all emails from the specific department
    in the output file. Please note that the output file must start with a number indicating the number of
    emails in the file. The user can enter only one integer number from 0 to 8</li>
    </ol>
  </blockquote>
  
  <p>and the subdomains its is talking about are</p>
  
  <blockquote>
    <p>1 art
    2 chee
    3 chem
    4 coe
    5 cs
    6 egr
    7 polsci</p>
  </blockquote>