When calling a method IOException Error appears
===

I am trying to write to a file. 

I have declared an exception in the method writeHtmlFile, but the error "unreported exception java.io.IOException must be caught or declared to be thrown" keeps appearing anyway when I try to call on the writeHtmlFile method?



    public class PartB extends ChangeDrawer
    {
      
      public static ChangeDrawer cd = new ChangeDrawer();
      static int[] floatDrawer = {8,5,4,4,5,20,20,6,10,3,8};
      
       {
          String selection="";
          Scanner scan = new Scanner (System.in); 
    
          System.out.println ("Enter P to make a purchase and receive your change");
          System.out.println ("Enter L to load the Change drawer");
          System.out.println ("Enter H to write the contents of the Change Drawer to a web page");
          System.out.println ("Enter E to exit the program");

          
        while (selection.compareTo("E")!=0)
        {
          selection = scan.next();
          if (selection.compareTo("P")== 0)
             makeChange();
          else if (selection.compareTo("L")==0)
             loadFloat();
           else if (selection.compareTo("H")==0)
             writeHtmlFile(); //unreported exception java.io.IOException must be caught or
                              //declared to be thrown


        }
            System.out.println ("Ending .............................. ");
        }
 

        //more code exists between these two sets

       public static void writeHtmlFile() throws IOException
       {
        FileWriter fwriter = new FileWriter("ChangeDrawer.html");
        PrintWriter outputFile = new PrintWriter(fwriter);
        outputFile.println("This should work!");
    
      }