473,387 Members | 1,569 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

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!

Expand|Select|Wrap|Line Numbers
  1. // HairColorInventory.Java
  2. // Hair color program
  3. import java.util.Scanner; // program uses class Scanner
  4.  
  5. public class HairColorInventory
  6. {
  7.      // main method begins execution of Java application
  8.      public static void main( String args[] )
  9.      {
  10.  
  11.      HairColor myHairColor = new HairColor();
  12.  
  13.      String [] productNumber = {0011, 0012, 0013, 0014, 0015};
  14.  
  15.      String [] itemName = {red, gold, blond, platinum, amber};
  16.  
  17.           int [] numberofUnits = {100, 130, 99, 40, 44};
  18.  
  19.           double [] priceperUnit = {75, 60, 55, 49, 52};
  20.  
  21.           double [] inventoryValue;
  22.  
  23.      double entireValue;
  24.      {
  25.  
  26.     for (int i = 0; i < 5; i++)
  27.     {
  28.         // for loop to print the array of items, item numbers, number of units, price, and value
  29.  
  30.  
  31.              System.out.println("\n\nitemName: "+itemName[i]);
  32.  //display item name
  33.              System.out.println("productNumber: "+productNumber[i]);
  34.  //display item number
  35.              System.out.println("Quantity in Stock: "+numberofUnits[i]);
  36.  //display quantity in stock
  37.              System.out.println("Item Price:$ "+priceperUnit[i]);
  38.  //display item price
  39.             System.out.printIn(inventoryvalue[i] = numberofunits[i] * priceperunit[i]);
  40.  //calculate the inventory value of each item
  41.              System.out.println("Value of Inventory:$ "+inventoryValue[i]);
  42.  //display total value of inventory for this item
  43.  
  44.      }
  45.         // end of for loop
  46.  
  47.  
  48.     for (int i = 0; i < 5; i++)
  49.     {
  50.         // for loop to calculate entire inventory value
  51.  
  52.         entireValue = entirevalue + inventoryvalue[i];
  53.         // calculation of entire inventory value
  54.  
  55.     }
  56.  
  57.     System.out.println("Entire inventory value:$ "+entireValue);
  58.     // display entire inventory value
  59.  
  60.     Manufacturer.myManufacturer();
  61.     // call subclass and display the manufacturer of the hair products
  62.  
  63.     System.out.println("The restocking fee of item " +itemName[1]+ ",product number " +productNumber[1]+ " is "+restockingFee(inventoryValue[1]));
  64.     // give the inventory restocking price for an item from the array by calling the restockingFee subclass
  65.  
  66.  
  67. } // end main method
  68. }}//end class HairColorInventory
  69.  
  70. public class Manufacturer extends HairColorInventory
  71.  
  72. {
  73.  
  74.     public static void myManufacturer()
  75.     {
  76.         System.out.println
  77.         ("Paul Mitchell is the Manufacturer of my Hair Inventory.");
  78. }
  79.  
  80. public class RestockingFee
  81.  
  82.  
  83. {
  84.  
  85. {
  86.  
  87.     double reStockFee;
  88.  
  89.     reStockFee = (oldInventoryCost * .05) + oldInventoryCost;
  90.  
  91.     return reStockFee;
  92.  
  93. }
  94.  
  95. }
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
Jan 28 '08 #1
3 11919
BigDaddyLH
1,216 Expert 1GB
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
Jan 28 '08 #2
BigDaddyLH
1,216 Expert 1GB
That means you have more "{" braces than "}" braces. Print your file, take a pencil and try to match all the braces: { ---> }
Jan 28 '08 #3
SammyB
807 Expert 512MB
-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 oldInventoryCost? Finally, it may not cause any problems, but why do you have Manufacturer extending HairColorInventory?

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
Jan 28 '08 #4

Sign in to post your reply or Sign up for a free account.

Similar topics

6
by: Hari Om | last post by:
Here are the details of my error log files: I execute the command and get following message at console: ---------------------------------------------------------------------- ../sqlldr...
2
by: Oxmard | last post by:
Armed with my new O'Reilly book Optimizing Oracle Performance I have been trying to get a better understanding of how Oracle works. The book makes the statement, " A database cal with dep=n + 1...
2
by: Cigdem | last post by:
Hello, I am trying to parse the XML files that the user selects(XML files are on anoher OS400 system called "wkdis3"). But i am permenantly getting that error: Directory0: \\wkdis3\ROOT\home...
5
by: baskarpr | last post by:
Hi all, I my program after parsing in SAX parser, I want to write the parse result as an XML file. I want to ensure that there should be no difference between source XML file and parse result xml...
5
AdrianH
by: AdrianH | last post by:
Assumptions I am assuming that you know or are capable of looking up the functions I am to describe here and have some remedial understanding of C++ programming. FYI Although I have called...
1
AdrianH
by: AdrianH | last post by:
Assumptions I am assuming that you know or are capable of looking up the functions I am to describe here and have some remedial understanding of C programming. FYI Although I have called this...
7
by: souravmallik | last post by:
Hello, I'm facing a big logical problem while writing a parser in VC++ using C. I have to parse a file in a chunk of bytes in a round robin fashion. Means, when I select a file, the parser...
13
by: max3 | last post by:
Hi,can somebody help me, I am trying to compile a programm but have an error it is called reached end of file while parsing?? Anyone mind th have a look for some help public class records { ...
1
by: kk975kom | last post by:
Hi can somebody help me ,iam trying to compile my java program but display error was reached end of file while parsing .please find the error in program.
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.