Results 1 to 2 of 2
  1. #1
    Weazel Boy is offline Member
    Join Date
    Jul 2010
    Rep Power

    Default Getting a successfully completed return from Textpad but with no respones from script

    Hello Java Friends,

    I am new to Java and this is my first actual post. My code is as follows:

    Java Code:
    public class SantiagoRalphProg4
      public static void main(String[] args)
        double speed;
        double stoppingDistance;
        System.out.println("Enter speed: ");
        speed = stdIn.nextDouble();
        System.out.println("Stopping distance: ");
        stoppingDistance = (speed * (2.25 + speed / 21));
        if (stoppingDistance < 178.5)
        System.out.println ("No problem");
        }//end if
        else if (stoppingDistance == 178.5)
        System.out.println("Minor Wreck");
        }//end else if
        System.out.println("Major Wreck");
        }//end else
      }//end main
    }//end class SantiagoRalphProg4

    I'm trying to get the stopping speed and corresponding response. Can anyone tell me where I am going wrong with the code?


    Weazel Boy
    Last edited by Fubarable; 07-06-2010 at 03:28 AM. Reason: Moderator Edit: Code tags added

  2. #2
    Fubarable's Avatar
    Fubarable is offline Moderator
    Join Date
    Jun 2008
    Blog Entries
    Rep Power


    Hello, and welcome to the forum. I hope you don't mind that I edited your code and added code tags which should help make your posted code retain its formatting and be more readable.

    To do this yourself, highlight your pasted code (please be sure that it is already formatted when you paste it into the forum; the code tags don't magically format unformatted code) and then press the code button, and your code will have tags.

    Another way to do this is to manually place the tags into your code by placing the tag [cod&#101;] above your pasted code and the tag [/cod&#101;] below your pasted code like so:

    Java Code:
      // your code goes here
      // notice how the top and bottom tags are different
    Now regarding your problem -- does your code even compile without error? I see right off the bat that it appears that you're trying to use a Scanner variable without declaring or initializing it.

    Best of luck, and again, welcome!

Similar Threads

  1. Mostly completed array search program
    By Ryujin89 in forum New To Java
    Replies: 1
    Last Post: 11-04-2009, 03:25 AM
  2. help with textpad and jdk
    By pinkdiamondgail in forum New To Java
    Replies: 4
    Last Post: 04-30-2009, 08:32 PM
  3. Has anyone here completed the SCJP course?
    By DonCash in forum Java Certification
    Replies: 3
    Last Post: 04-29-2008, 10:24 AM
  4. about textpad
    By fred in forum New To Java
    Replies: 3
    Last Post: 08-06-2007, 06:02 PM

Posting Permissions

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