import javax.swing.*;
import java.awt.event.*;

public class Control implements ActionListener {
 
       private Input view;
       private Calculator calc;
 
    public Control(){
        view = new Input(this);
        calc = new Calculator();
    }
 
    public void actionPerformed(ActionEvent event) {
       //COMPLETE IN LAB:
       //First, get the original distance, original time (hours, minutes, and seconds), 
       //and new distance from the view object.
 
       try {
              if (origDistance <= 0 || newDistance <= 0) {
                     throw new Exception("Error: Distances must be > 0");
              }
              
              //COMPLETE IN LAB:
              //If the seconds or hours of the original time are greater than 0,
              //throw a new Exception with an appropriate error message.    
 
       }
       catch (Exception e) {
              String message = e.getMessage();
              
              //COMPLETE IN LAB:
              //Write code that displays a message box with the text in String message
 
              return;
       }
              //COMPLETE IN LAB:
              //Set the original distance, original time, and new distance in the
              //calc object.  These are the values you got above from the view object.
              
              //Finally, get the new time from the calc object and give that new time
              //to the view object. 
       }
}