reached end of file while parsing

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • spittinfire
    New Member
    • Jan 2008
    • 1

    reached end of file while parsing

    --------------------------------------------------------------------------------

    I am trying to correct the errors on an assignment that has already been graded because I have to now modify it and add to it for my next assignment. I dont want to go to my next assignment when I cannot even fix this error. The error and it is the only error I have thank goodness, says "reached end of file while parsing". Can anyone please take a look, thank you very much!

    [CODE=Java]// HairColorInvent ory.Java
    // Hair color program
    import java.util.Scann er; // program uses class Scanner

    public class HairColorInvent ory
    {
    // main method begins execution of Java application
    public static void main( String args[] )
    {

    HairColor myHairColor = new HairColor();

    String [] productNumber = {0011, 0012, 0013, 0014, 0015};

    String [] itemName = {red, gold, blond, platinum, amber};

    int [] numberofUnits = {100, 130, 99, 40, 44};

    double [] priceperUnit = {75, 60, 55, 49, 52};

    double [] inventoryValue;

    double entireValue;
    {

    for (int i = 0; i < 5; i++)
    {
    // for loop to print the array of items, item numbers, number of units, price, and value


    System.out.prin tln("\n\nitemNa me: "+itemName[i]);
    //display item name
    System.out.prin tln("productNum ber: "+productNu mber[i]);
    //display item number
    System.out.prin tln("Quantity in Stock: "+numberofU nits[i]);
    //display quantity in stock
    System.out.prin tln("Item Price:$ "+priceperU nit[i]);
    //display item price
    System.out.prin tIn(inventoryva lue[i] = numberofunits[i] * priceperunit[i]);
    //calculate the inventory value of each item
    System.out.prin tln("Value of Inventory:$ "+inventoryValu e[i]);
    //display total value of inventory for this item

    }
    // end of for loop


    for (int i = 0; i < 5; i++)
    {
    // for loop to calculate entire inventory value

    entireValue = entirevalue + inventoryvalue[i];
    // calculation of entire inventory value

    }

    System.out.prin tln("Entire inventory value:$ "+entireVal ue);
    // display entire inventory value

    Manufacturer.my Manufacturer();
    // call subclass and display the manufacturer of the hair products

    System.out.prin tln("The restocking fee of item " +itemName[1]+ ",product number " +productNumber[1]+ " is "+restockingFee (inventoryValue[1]));
    // give the inventory restocking price for an item from the array by calling the restockingFee subclass


    } // end main method
    }}//end class HairColorInvent ory

    public class Manufacturer extends HairColorInvent ory

    {

    public static void myManufacturer( )
    {
    System.out.prin tln
    ("Paul Mitchell is the Manufacturer of my Hair Inventory.");
    }

    public class RestockingFee


    {

    {

    double reStockFee;

    reStockFee = (oldInventoryCo st * .05) + oldInventoryCos t;

    return reStockFee;

    }

    }[/CODE]

    Here is my error:
    C:\Documents and Settings\Owner\ My Documents\part3 .java:95: reached end of file while parsing
    }
    ^
    1 error

    Tool completed with exit code 1
    Last edited by BigDaddyLH; Jan 28 '08, 03:46 AM. Reason: added code tags
  • BigDaddyLH
    Recognized Expert Top Contributor
    • Dec 2007
    • 1216

    #2
    Please enclose your posted code in [code] tags (See How to Ask a Question).

    This makes it easier for our Experts to read and understand it. Failing to do so creates extra work for the moderators, thus wasting resources, otherwise available to answer the members' questions.

    Please use [code] tags in future.

    MODERATOR

    Comment

    • BigDaddyLH
      Recognized Expert Top Contributor
      • Dec 2007
      • 1216

      #3
      That means you have more "{" braces than "}" braces. Print your file, take a pencil and try to match all the braces: { ---> }

      Comment

      • SammyB
        Recognized Expert Contributor
        • Mar 2007
        • 807

        #4
        Originally posted by spittinfire
        -The error and it is the only error I have thank goodness...
        Unfortunately, as you will soon learn, the compiler only detected one error, but when you fix it, there will be more errors. Do as BigDaddy suggested, plus you might want to remove some of the unnecessary braces: they are causing you to lose your place; for example, the comment at line 67 is wrong, the actual end of main is the first brace at line 68.

        Also, line 13 & 15 are defining string arrays, but there are no strings. You also need to watch your capital letters; for example, in line 52, the compiler thinks that entireValue and entirevalue are two different variables. Another thing, there is some code missing: there no definition for the HairColor class. There are some problems with the call to the restockingFee method on line 63. Remember that this method in in a different class, so how do you have to call it? Speaking of the restocking method, check your method header, also where does it get oldInventoryCos t? Finally, it may not cause any problems, but why do you have Manufacturer extending HairColorInvent ory?

        Sorry for th big list, but hopefully this will get you back on track. Post back with your new code if you are still having problems! HTH --Sam

        Comment

        Working...