import java.io.*;
public class PSA8A
{
   public static void main(String [] args)
   {
     boolean found = false;
     boolean shrink = false;
     boolean done = false;
     BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
     Picture pic = new Picture(FileChooser.pickAFile());
     pic.show();
     try{
       while(!done){
           while(!found){
               System.out.println("Would you like to shrink or enlarge your image?");
               String option = br.readLine();
               //IF THEY CHOSE SHRINK, found = true; and shrink = true;
               //ELSE, IF THEY CHOSE ENLARGE, found = true; and shrink = false;
               //ELSE, IF THEY CHOSE SOMETHING ELSE,
                   System.out.println("Please choose shrink or enlarge.");
           }
          //IF THEY CHOSE TO SHRINK
              System.out.println("By how much would you like to shrink your image?");
             
int factor = (new Integer((br.readLine())).intValue());
              pic = pic.shrink(factor);
              pic.repaint();
         //ELSE
              System.out.println("By how much would you like to enlarge your image?");
             
int factor = (new Integer((br.readLine())).intValue());
              pic = pic.enlarge(factor);
              pic.repaint();
         System.out.println("Are you done resizing?");
        
String finished = br.readLine();
         //IF THEY ARE DONE              done = true;
       }
     }
     catch(IOException e){
       System.exit(0);
     }
   }
}