Results 1 to 4 of 4
  1. #1
    pinhead is offline Member
    Join Date
    Apr 2011
    Posts
    2
    Rep Power
    0

    Default Unreported Exception? Please help!

    What does this mean? I am new to Java (changing careers) and trying to go back to school after years out!
    I am compiling and getting the following error:
    DriverProj3.java:196: unreported exception java.io.IOException; must be caught or declared to be thrown
    processDetail();
    ^

    the script follows:

    import java.io.*;

    public class DriverProj3
    {
    public static void main(String args[]) throws IOException
    {
    Proj3 app;
    app = new Proj3();
    app.appMain();
    } //end of main()
    }

    class Proj3
    {
    /* Instance Data Declarations */
    String itemDesc; // Item description
    int quantitySold; // Quantity of appliance sold
    float unitPrice; // Sales Price per unit
    float unitCost; // Cost per appliance
    float salesTax; // enter sales tax as a decimal
    float transactionAmt; // Quantity * Price
    float transactionCost; // Quantity * Cost
    float ttltransAmt; // Total amount of transactions
    float ttltransCost; // Total transactions costs
    float ttlProfit; // Total sales - total cost
    float ttltaxColl; // Total tax collected
    int ttlqtySld; // Total Qty Sold
    float avgqtySold; // Total amount/ttl Qty
    float minsalesAmt; // smallest sales amount
    String minsalesDesc; // smalles sales description
    int salesCnt; //
    String numString; // number string input
    BufferedReader stdin; // define stdin

    /*appMain module calls for intialization, processing, output*/

    public void appMain() throws IOException
    {
    BufferedReader stdin = new BufferedReader
    (new InputStreamReader (System.in));
    //create input string object

    System.out.println("\n in fulfillment of the requirments for Project 3" );

    initMonth();
    processDetail();
    updateTots();
    updateMin();

    } //end of appMain()



    /*initialize month once */
    void initMonth() throws IOException
    {
    salesTax = 0;

    BufferedReader stdin = new BufferedReader
    (new InputStreamReader (System.in));
    //create input string object


    System.out.print(" Input sales tax amount as decimal");
    numString = stdin.readLine();
    salesTax = Float.parseFloat(numString);

    quantitySold = 0;
    unitPrice = 0; // Sales Price per unit
    unitCost = 0; // Cost per appliance
    transactionAmt = 0; // Quantity * Price
    transactionCost = 0; // Quantity * Cost
    ttltransAmt =0; // Total amount of transactions
    ttltransCost =0; // Total transactions costs
    ttlProfit = 0; // Total sales - total cost
    ttltaxColl = 0; // Total tax collected
    ttlqtySld = 0; // Total Qty Sold
    avgqtySold = 0; // Total amount/ttl Qty
    minsalesAmt= 999999; // smallest sales amount
    minsalesdesc = "a"; // smalles sales description
    return;

    }
    // end of initMonth()


    /* process monthly sales data */
    void processDetail() throws IOException
    {

    BufferedReader stdin = new BufferedReader
    (new InputStreamReader (System.in));
    //create input string object


    itemDesc = "a";
    System.out.print(" Enter item description");
    itemDesc = stdin.readLine();

    {
    if(itemDesc.equals("Done"))
    outReport();

    else

    processdetailFin();
    }
    return;
    }
    /* process attendance for a single class */
    void processdetailFin() throws IOException

    {
    BufferedReader stdin = new BufferedReader
    (new InputStreamReader (System.in));
    //create input string object


    System.out.print(" Enter Quantity Sold ");
    numString = stdin.readLine();
    quantitySold = Integer.parseInt(numString);

    System.out.print(" Enter Unit Price ");
    numString = stdin.readLine();
    unitPrice = Float.parseFloat(numString);

    System.out.print(" Enter Unit Cost ");
    numString = stdin.readLine();
    unitCost = Float.parseFloat(numString);


    updateTots();
    }

    //end processdetailFin()

    /* update Min Sales and Description */

    void updateMin()
    { {
    if(transactionAmt < minsalesAmt)

    updateminTwo();
    else
    minsalesAmt = minsalesAmt;
    }
    return;
    } // end updateMin()

    /*update totals */
    void updateTots()
    {
    ttltransAmt = transactionAmt + ttltransAmt;
    ttltransCost = transactionCost + ttltransCost;
    ttlProfit = ttltransAmt - ttltransCost;
    ttlqtySld = quantitySold + ttlqtySld;
    salesCnt = salesCnt + 1;
    avgqtySold = ttlqtySld/salesCnt;
    return;

    } //end updateTots()

    /*update MINfinal */
    updateminTwo()
    { {
    minsalesAmt = transactionAmt;
    itemDesc = minsalesDesc;
    }
    processDetail();
    }

    //end updateMinTwo



    /*output sales numbers */
    void outReport() throws IOException
    {
    System.out.println("\nTotal transactions amount is" + ttltransAmt);
    //System.out.println("\nTotal transactions costs are" + ttltransCost);
    //System.out.println("\nTotal Profit is" +ttlProfit);
    //System.out.println("\nTotal taxes collected are" + ttlsalesTax);
    //System.out.print("\nThe Average quantity sold is" + avgqtySold);
    //System.out.print("\nThe Average quantity sold is" + minsalesAmt + "for item" + minsalesDesc);
    initMonth();
    }
    }
    // end outReport ()

  2. #2
    Fubarable's Avatar
    Fubarable is offline Moderator
    Join Date
    Jun 2008
    Posts
    19,309
    Blog Entries
    1
    Rep Power
    32

  3. #3
    Dark's Avatar
    Dark is offline Senior Member
    Join Date
    Apr 2011
    Location
    Camp Lejuene, North Carolina
    Posts
    643
    Rep Power
    10

    Default

    Also, for future reference. People are more likely to read your code if you put them in [code][/code] tags.
    • Use [code][/code] tags when posting code. That way people don't want to stab their eyes out when trying to help you.
    • +Rep people for helpful posts.

  4. #4
    pinhead is offline Member
    Join Date
    Apr 2011
    Posts
    2
    Rep Power
    0

    Default Thanks for your help.

    The tutorial got me the answer I needed

Similar Threads

  1. unreported exception java.io.IOException
    By fluffaykitties in forum New To Java
    Replies: 11
    Last Post: 03-07-2011, 01:59 AM
  2. Replies: 5
    Last Post: 02-14-2011, 11:39 PM
  3. unreported exception -- reiro
    By Reiro in forum New To Java
    Replies: 4
    Last Post: 08-23-2010, 03:45 PM
  4. unreported exception (socket connection)
    By Symbiot in forum New To Java
    Replies: 7
    Last Post: 05-28-2010, 11:13 AM
  5. Unreported exception java.sql.SQLException
    By javamula in forum AWT / Swing
    Replies: 4
    Last Post: 09-29-2009, 02:32 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •