// Terminal2 Class
/** Created by:
 *             Jonathan Kensler
 *             Yaw A. Nti-Addae
 *             Patric Knoedler
 */

import SimpleInput;
import SimpleOutput;
import Coordinator2;
import InstructorNotifier2;
import java.io.*;

public class Terminal2 implements SchemeTesterInterface2{

    /** The printer method takes the results of testing the code from the
     * outputformatter and displays it on the screen.And gives the user
     * the option to send it to the instructor, redo the process or quit.
     */

    SimpleOutput out;

    public Terminal2 () {
        out = new SimpleOutput ();
        out.println ("Terminal2::main called");
        // Call Coordinator2
        Coordinator2 coord = new Coordinator2();
        try {
            coord.dostuff("Student User",  // username
                          1.0,  // lab number
                          "/home/walker/152/project.s01/test1.ss", // user program name
                          "", // special test file name
                          this);
        } catch (Exception e) {}
    }

    public void printer(String results) {

        out.println ("GUI1::printer called with parameter");
        out.println ("     results:" + results);

        try{
            out.println ("     formulating message of results with subject 'CSC 151 test'");
            SimpleInput in = new SimpleInput ();
            
            InstructorNotifier2 mailObj = new InstructorNotifier2 ();
            out.print ("Enter your e-mail address:  ");
            String emailAddress = in.readString();
            
            mailObj.notifyEmail(emailAddress, "CSC 151 test", "results were:\n" + results);
        }
        catch (IOException exc){}

    }// printer(String)

    /**
     * The terminal2 method reads in the information of the user and send
     * them to the coordinator.
     */
    public static void main (String [] args ) {
        Terminal2 term = new Terminal2();

    } //main
}// Terminal2

