473,856 Members | 1,690 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

reached end of file while parsing

1 New Member
--------------------------------------------------------------------------------

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 11949
BigDaddyLH
1,216 Recognized Expert Top Contributor
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 Recognized Expert Top Contributor
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 Recognized Expert Contributor
-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
Jan 28 '08 #4

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

Similar topics

6
44137
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 scott/tiger@common control=/full_path/test.ctl log=/full_path/adhoc/test.log SQL*Loader: Release 9.2.0.1.0 - Production on Tue Sep 2 10:49:27 2003 Copyright (c) 1982, 2002, Oracle Corporation. All rights reserved.
2
3435
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 is the recursive child of the first subsequent dep=n database call listed in the SQL data stream. The book gives a few examples, and in trying it out it seemed to work until I tried the following SQL. My question are why does this not keep with...
2
3966
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 Canonicalpath-Directory4: \\wkdis3\ROOT\home\bwe\ You selected the file named AAA.XML getXmlAlgorithmDocument(): IOException Not logged in
5
3802
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 file. Because I set some properties in parser, which may cause to changes between actual and parsed. What I expect is the exact XML file structure is to be available into another XML file (incl white spc's) after SAX parsing. Below is a snippet...
5
64664
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 article “How to Parse a File in C++”, we are actually mostly lexing a file which is the breaking down of a stream in to its component parts, disregarding the syntax that stream contains. Parsing is actually including the syntax in order to make...
1
64270
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 article “How to Parse a File in C++”, we are actually mostly lexing a file which is the breaking down of a stream in to its component parts, disregarding the syntax that stream contains. Parsing is actually including the syntax in order to make...
7
2864
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 will read first 512kb(IBUFFSIZE) of data, then move to next file and parse the same way. This way I can parse a number of file spreaded over different directory uniformly. I'm keeping a meta data in a file where I'm keeping the track of file parse...
13
5919
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 { public static void main (String args){ System.out.println("Enter name"); float name = Keyboard.readInt(); switch (name) {
1
5419
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
9916
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
11056
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10696
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
10384
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
7932
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
7093
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
1
4575
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
4174
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
3201
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.