Over 500 Magazines for FREE!

Yes! You can subscribe to ALL of them. They will be shipped to your home FREE of cost!
Kindly click here to apply!

If Else Statement

If else if Statement

  1. import java.util.Scanner;
  2. public class AnthonyWhiteProg4
  3. {
  4. public static void main(String[] args)
  5. {
  6. Scanner stdIn = new Scanner(System.in);
  7. double speed; // User entered value
  8. double distance; // user entered value
  9. double stoppingDistance = speed * (2.25 + speed/21); // number
  10.  
  11. System.out.print("Enter your speed (mph): ");
  12. speed.stdIn.nextDouble();
  13. System.out.print("Enter your tailgate distance: ");
  14. stoppingDistance.stdIn.nextDouble();
  15.  
  16. if(stoppingDistance==tailGatingDistance);
  17. {
  18. system.out.println("Minor wreck");
  19. }
  20. if(stoppingdistance > tailGatingDistance);
  21. {
  22. system.out.println("No problem");
  23. }
  24. else
  25. {
  26. system.out.println("Major wreck");
  27. }
  28. } // end main
  29. } // end class

running?

is the program above is running???
please do reply.,.

Post new comment

To combat spam, please enter the code in the image.




Do you have a better example?
We're sure you have hundreds of Java program examples.

Spare some time and submit your java example here even if you think it's too small to contribute.

Could not find what you are looking for? Search Java Examples




Feel Tired? Read Jokes & Inspirational Stories, Play Games!