473,427 Members | 1,623 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,427 software developers and data experts.

reached end of file while parsing

Expand|Select|Wrap|Line Numbers
  1. import javax.swing.JOptionPane;  
  2.  
  3. public class DistanceTraveled  
  4.  
  5.  {  
  6. public static void main(String[] args)  
  7.  
  8.  {  
  9.  
  10.  int Distance;  // D = Distance Traveled  
  11.  
  12.  int Speed;  // S = Speed entered by user
  13.  
  14.  int Time;  // T = Time entered by user
  15.  
  16.  String Input;  
  17.  input = JOptionPane.showInputDialog("What is the speed " + "of the vehicle in miles-per-hour?");  
  18.  
  19.  Speed = Integer.parseInt(input);  
  20.  
  21.  
  22.  
  23.  while (Speed < 0)  
  24.  
  25.  {  
  26.  
  27.  Input = JOptionPane.showInputDialog("What is the speed " + "of the vehicle in miles-per-hour? " + "*Please enter a POSITIVE number*");  
  28.  
  29.  Speed= Integer.parseInt(input);  
  30.  
  31.  }  
  32.  
  33.  
  34.  Input = JOptionPane.showInputDialog("How many hours " + "has the vehicle traveled for?");  
  35.  
  36.  Time = Integer.parseInt(Input);  
  37.  
  38.  
  39.  while (Time < 1)  
  40.  
  41.  {  
  42.  
  43.  input = JOptionPane.showInputDialog("How many hours " + "has the vehicle traveled for? " + "*Please enter a value that is not less than 1*");  
  44.  
  45.  Time = Integer.parseInt(Input);  
  46.  
  47.  }      
  48.  
  49.  Distance = Speed * Time;  //
  50.  
  51.  
  52.  System.out.println("Hour Distance Traveled");  
  53.  
  54.  System.out.println("------------------------");  
  55.  
  56.  System.out.println(Time + "\t\t" + Distance);  
  57.  
  58.  
  59.  for(int Input=1; Input<=Time; Input++)  
  60.  
  61.  {  
  62.  
  63.  System.out.println("Hour " + Input + ": " + (Speed*Input) + " miles traveled");
  64.  }
I keep getting this message when i try to compile my program.
reached end of file while parsing
Can anyone tell me what's wrong?
I do not think i have to many brackets.
Oct 6 '10 #1
2 1273
Dheeraj Joshi
1,123 Expert 1GB
Is this code complete? I can not see the closing braces for main method and for your class.

Regards
Dheeraj Joshi
Oct 7 '10 #2
u get this error for improper closing of ur braces
Oct 11 '10 #3

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

Similar topics

4
by: Marian Jancar | last post by:
Hi, Is there a module for parsing spec files available? Marian -- -- Best Regards,
3
by: Willem Ligtenberg | last post by:
I decided to use SAX to parse my xml file. But the parser crashes on: File "/usr/lib/python2.3/site-packages/_xmlplus/sax/handler.py", line 38, in fatalError raise exception...
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...
4
by: sunil | last post by:
I am creating a XML document which opens fine in IE. Implies MSXML thinks it is a well formed document. But when I try to load this document in VB.net using the following code Dim doc As New...
1
by: Christoph Bisping | last post by:
Hello! Maybe someone is able to give me a little hint on this: I've written a vb.net app which is mainly an interpreter for specialized CAD/CAM files. These files mainly contain simple movement...
11
by: .Net Sports | last post by:
In VB.net, I'm trying to do a couple of things in a couple of different blocks of code. I need to take the first 25 characters of a text file, then append at the end some ellipses and a MORE link...
1
by: Thomas Kowalski | last post by:
Hi, I have to parse a plain, ascii text file (on local HD). Since the file might be many millions lines long I want to improve the efficiency of my parsing process. The resulting data structure...
1
by: Ricardo Vazquez | last post by:
I'm writing log information into a file (via StreamWriter). When it reached a 4GB size, my MFC/C++ code copied that file to another name, truncated its length to 0 (CFile::SetLength(0)), and...
4
by: DjLethal | last post by:
Hey Guys.I am a newbie on Perl.And I have a question about file parsing by perl. I have a log file which contains reports about a communication machine.I need to take some of the reports from the...
2
by: Felipe De Bene | last post by:
I'm having problems parsing an HTML file with the following syntax : <TABLE cellspacing=0 cellpadding=0 ALIGN=CENTER BORDER=1 width='100%'> <TH BGCOLOR='#c0c0c0' Width='3%'>User ID</TH> <TH...
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:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
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,...
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
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,...
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...
1
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
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...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?

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.