Results 1 to 9 of 9
  1. #1
    Angel is offline Member
    Join Date
    Oct 2013
    Posts
    5
    Rep Power
    0

    Default Odd Java Error code 130, need help urgently HW due tonight

    This is due tonight....please help... the error starts with an interruption of the program as follows

    Interrupted!

    Tool Completed With Exit Code 130

    here's my code:

    Java Code:
    import java.io.*;
    import java.awt.*;
    import java.util.*;
    
    public class Traffic
    {
    	public static void main(String[]args) throws IOException
    	{
    		// Declare variables
    		String speedLimit, speedActual, totalCharge, speedDifference, previousTickets;
    		double mphLimit=0.0, mphActual=0.0, finesTotal = 0.0, mphDifference=0.0;
    		int numberOfTickets=0;
    		BufferedReader dataIn = new BufferedReader(new InputStreamReader(System.in));
    
    		System.out.println("Please enter the actual speed limit: ");
    		speedLimit = dataIn.readLine();
    		mphLimit = Double.parseDouble(speedLimit);
    		System.out.println("Please enter the speed the individual was traveling: ");
    			speedActual = dataIn.readLine();
    			mphActual = Double.parseDouble(speedActual);
    		System.out.println("Please enter the total number of previous tickets issued to individual: ");
    			previousTickets = dataIn.readLine();
    			numberOfTickets = Integer.parseInt(previousTickets);
    
    		// Speed over the limit
    		mphDifference = mphActual - mphLimit;
    
    		// Total fines
    		finesTotal = getCharge(mphDifference,numberOfTickets, mphDifference);
    	}
    
    	public static double getCharge(double speedDifference, int numberOfTickets, double mphDifference)
    	{
    		double finesTotal = 0.0;
    		if(numberOfTickets==0) finesTotal = ((speedDifference * 20) + 74.80);
    
    		else
    			if(numberOfTickets>=1)
    
    			if(numberOfTickets<=3) finesTotal = ((speedDifference * 20 + 25 * numberOfTickets) + 74.80);
    
    			else
    				if(numberOfTickets>3) finesTotal = (((speedDifference * 20) + 75 + 74.80));
    
    		if(speedDifference<=0) System.out.println("This individual should not be issued a ticket!");
    
    		else
    			if(speedDifference>0) System.out.println("This individual has "+numberOfTickets+
    				" previous tickets, and was traveling over the speed limit by "+mphDifference+
    				" MPH, their total fines (including court costs) is: "+finesTotal);
    
    		return finesTotal;
    	}
    }
    Last edited by Angel; 10-26-2013 at 01:59 AM.

  2. #2
    Norm's Avatar
    Norm is offline Moderator
    Join Date
    Jun 2008
    Location
    SW Missouri
    Posts
    17,306
    Rep Power
    25

    Default Re: Odd Java Error code 130, need help urgently HW due tonight

    How are you executing the program? I've never seen that error message.

    Please edit your post and wrap your code with code tags:
    [code]
    YOUR CODE HERE
    [/code]
    to get highlighting and preserve formatting.
    If you don't understand my response, don't ignore it, ask a question.

  3. #3
    Angel is offline Member
    Join Date
    Oct 2013
    Posts
    5
    Rep Power
    0

    Default Re: Odd Java Error code 130, need help urgently HW due tonight

    I edited....

    using Textpad, this is required for our course...use cntl 1, then cntl 2....it starts to run and I get the first output line "Please enter the actual speed limit:"...then it chimes and says Interuppted!...etc.

  4. #4
    Norm's Avatar
    Norm is offline Moderator
    Join Date
    Jun 2008
    Location
    SW Missouri
    Posts
    17,306
    Rep Power
    25

    Default Re: Odd Java Error code 130, need help urgently HW due tonight

    Do you have a website for TextPad? Your problem does not sound like a java programming problem.

    Have you tried executing the program with the java command to see if there are java problems?
    If you don't understand my response, don't ignore it, ask a question.

  5. #5
    Angel is offline Member
    Join Date
    Oct 2013
    Posts
    5
    Rep Power
    0

    Default Re: Odd Java Error code 130, need help urgently HW due tonight

    website is Textpad.com

    what do you mean by java command....I'm just learning java and we use textpad. To run you either go to tools, external tools and then click javaac (cntrl 1), java (cntrl 2)....cntrl 3 is to run in html.

  6. #6
    Norm's Avatar
    Norm is offline Moderator
    Join Date
    Jun 2008
    Location
    SW Missouri
    Posts
    17,306
    Rep Power
    25

    Default Re: Odd Java Error code 130, need help urgently HW due tonight

    I don't know anything about TextPad. The error message probably comes from the TextPad program.
    You need to read the TextPad documentation to see what causes the error. It is not a java program error.

    The java command is used to execute java programs.
    If you don't understand my response, don't ignore it, ask a question.

  7. #7
    Angel is offline Member
    Join Date
    Oct 2013
    Posts
    5
    Rep Power
    0

    Default Re: Odd Java Error code 130, need help urgently HW due tonight

    The java command is used to run the program. Textpad is a free (you evaluate for free for as long as you want) that my school requires you use.

    I have read through the Textpad information and I haven't found anything. Textpad is like notepad ++.

  8. #8
    Norm's Avatar
    Norm is offline Moderator
    Join Date
    Jun 2008
    Location
    SW Missouri
    Posts
    17,306
    Rep Power
    25

    Default Re: Odd Java Error code 130, need help urgently HW due tonight

    Sorry, I don't know anything about TextPad. You need to find a forum that supports TextPad.
    If you don't understand my response, don't ignore it, ask a question.

  9. #9
    Angel is offline Member
    Join Date
    Oct 2013
    Posts
    5
    Rep Power
    0

    Default Re: Odd Java Error code 130, need help urgently HW due tonight

    Well I appreciate your help though...

    I have posted on a couple of sites but you are the only one that has responded so far...of course it's Friday and everybody's probably out and about.

    again, thanks for your help

    Angel

Similar Threads

  1. Replies: 1
    Last Post: 12-11-2012, 11:24 PM
  2. Urgently need a countdown timer code...
    By BZwap in forum New To Java
    Replies: 5
    Last Post: 05-08-2011, 06:51 AM
  3. Replies: 8
    Last Post: 06-06-2010, 03:10 PM
  4. need help urgently new to java
    By deecaf in forum New To Java
    Replies: 10
    Last Post: 07-04-2009, 04:47 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •