473,405 Members | 2,444 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,405 software developers and data experts.

cant find the error?

Expand|Select|Wrap|Line Numbers
  1. import java.io.*;
  2. import javax.swing.JOptionPane;
  3.  
  4. public class Errors
  5. {
  6.       public static void main(String[] args)
  7.       {
  8.  
  9.         String line;
  10.         int startMiles = 0;
  11.         double endMiles = 0;
  12.         double gallons = 0;
  13.         boolean done = false;
  14.  
  15.         while(!done)
  16.         {
  17.             try
  18.             {
  19.                 String start = JOptionPane.showInputDialog(null,"Enter starting mileage: " );
  20.                 startMiles = Integer.parseInt(start);
  21.  
  22.                 String end =JOptionPane.showInputDialog(null,"Enter ending mileage: " );
  23.                 endMiles = Integer.parseInt(end);
  24.  
  25.                 if (endMiles<=startMiles) throw new NumberFormatException e();
  26.  
  27.                 String amount = JOptionPane.showInputDialog(null,"Enter number of gallons: " );
  28.                 gallons = Integer.parseInt(amount);
  29.                 done = true;
  30.             }
  31.             catch(NumberFormatException e)
  32.             {
  33.                 JOptionPane.showMessageDialog(null, "Your ending mileage,",endMiles +", must be greater than your starting mileage, " + startMiles, "Error in Mileage",JOptionPane.INFORMATION_MESSAGE);
  34.             }
  35.         public static void finish()
  36.         {
  37.         JOptionPane.showMessageDialog(null,"Miles per gallon is "+ (endMiles - startMiles)/gallons);
  38.         }
  39.         }
  40.     }
  41. }
Dec 8 '09 #1
1 1415
Frinavale
9,735 Expert Mod 8TB
What IS the error?

You can't just post a bunch of code and title the thread "Can't find the error". It's unfair to expect people to sift through tons of code to find the few lines that you are having problems. Never mind that you haven't even provided any explanation as to what the problem is!

Please specify what you are having problems with, what (if any) errors you are getting, and what you have tried to solve the problem. Don't just post a bunch of code and expect us to figure out what it is, what's wrong with it, and what you are having problems with.

Please check out the posting guidelines for more information on how to ask a question.

-Frinny
Dec 8 '09 #2

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

Similar topics

0
by: IanT | last post by:
Hi I'm using Visual C++ .net I'm getting the linker error that one of my object files cant be found It seems that my compiler isnt producing .obj files (or at least not putting them in the debug...
0
by: Tony Lewis | last post by:
I'm running IIS on a Windows 2k server and have just installed the .NET framework 1.1 so I can deploy ASP.NET applications on my server through .NET Studios. All my normal ASP applications run fine...
1
by: Eric | last post by:
This program is running fine in my office i just copy it and run at home it start given that error and highlight Chr(13). I dont know is this is what the error is or some thing else Compiler...
0
by: vinidimple | last post by:
Hi i have a serious problem while i was working in Excel.I want to fetch columns from an excel worksheet and i need to compare it with an sql querry fields,so i tried to open an excle...
1
by: niraj | last post by:
I am getting the following error /usr/bin/ld: cant find -lutl Please advice which module i need to install .I am unable to find it . TIA Niraj
2
by: andrewanderson | last post by:
hi can anyone help me with this prog. cant find the prob why it cant display cout<<"This is the display of your transaction"<<endl; ifstream fobj; //declare input file stream ...
2
by: moondaddy | last post by:
I had to repost this because I had to update and change my msdn alias. I will re-ask the question and clarify a few things that were not clear before. This code is all executed on my dev...
1
by: durjoy | last post by:
dunno is the right forum to ask for help , but i cant see any category for html help . dont know any other site as well . this site is my last hope dear experts . i was hosting my site with...
6
by: WolfgangS | last post by:
Ok first off, i am a total beginner at this groups stuff and i have no clue how this works. This is probabaly the wrong group for my problem but i will post it anyways. Learning by doing right? ...
1
by: qwert7465 | last post by:
here is my code. i am only getting one error: // Final Project #include <iostream.h> #include <iomanip.h> void checkout(); void start_or_startover();
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:
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
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...

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.