473,795 Members | 3,100 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 1294
Dheeraj Joshi
1,123 Recognized Expert Top Contributor
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
b laxmikanth
2 New Member
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
3582
by: Marian Jancar | last post by:
Hi, Is there a module for parsing spec files available? Marian -- -- Best Regards,
3
3661
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 xml.sax._exceptions.SAXParseException: NCBI_Entrezgene.dtd:8:0: error in processing external entity reference This is caused by: <!DOCTYPE Entrezgene-Set PUBLIC "-//NCBI//NCBI Entrezgene/EN" "NCBI_Entrezgene.dtd">
2
3959
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
4
11999
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 XmlDocument doc.Load("C:\Projects\SQLXML\corc.xml") I get the following error: "System.Xml.XmlException: An unexpected end of file parsing CDATA has
1
2465
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 and drawing instructions like "move to's" and "change color's" optionally followed by one or more numeric (int or float) arguments. My problem is that the parsing algorithm I've currently implemented is extremely slow.
11
2840
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 to a webpage where viewers can read the rest of the article: This is the first few characters of text from my file.......<a href="article-to-read.aspx"> MORE </a> ...I also need to do some in file parsing where I start at one known keyword (START...
1
2299
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 shall look like this the following: class A { ... int value; }
1
1621
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 continued writing (no need to close and open, so that it was very quick). How is it the best .net way to get this "file change" the quickest possible? Thanks! Ricardo Vázquez.
4
1870
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 log file.Its hard to explain the issue.but shortly I can say that the reports has a unique report no. and this report number is located at the 3rd line and at the end of the report.How can I parse these reports?(I need all of the lines like below.) It...
2
3617
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 Width='10%' BGCOLOR='#c0c0c0'>Name</TH><TH width='7%' BGCOLOR='#c0c0c0'>Date</TH> and so on.... whenever I feed the parser with such file I get the error :
0
9672
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
9519
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10213
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...
1
10163
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
10000
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
7538
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
5436
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5563
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
3721
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.