View Single Post
Old 09-25-2008, 12:03 AM   PM User | #1
BWiz
Regular Coder

 
BWiz's Avatar
 
Join Date: Mar 2006
Location: Sol System
Posts: 471
Thanks: 7
Thanked 21 Times in 21 Posts
BWiz is an unknown quantity at this point
Stopping Java Application depending on user input

I'm coding a little program that calculates the difference between an arrival time and departure time. Below is a little snippet of the app that calculates the difference:

Code:
public int DifferenceInHours(int Departure, int Arrival) {
        int difference = 0;
        if ( Departure >= Arrival ) {
            System.out.println("The times you entered seemed to be incorrect.");
            // I want to stop here...
        }
        difference = Arrival - Departure;
        return difference;
    }
Now say, if the departure time is greater than the arrival time, how would I stop the application completely from processing any further?

Thanks,
BWiz.
__________________
BWiz :: Happy Coding!
2006
2007 2008 2009
2010 2011
Irrational numbers make no sense.
BWiz is offline   Reply With Quote