All pastes #755187 Raw Edit

Someone

public text v1 · immutable
#755187 ·published 2007-10-30 15:05 UTC
rendered paste body
import java.util.Scanner;
public class flowChart
{
    public static void main(String [] args)
    {
        Scanner sc = new Scanner( System.in );
        int x;
        int num=0;
        String exitPrompt="";
        System.out.println("You may exit the program by typing 'end' at any time."
                           + "\nPlease enter a number: ");
            if (sc.hasNextInt())
                {
                    num = sc.nextInt();
                }else{
                    System.out.println("Not a valid integer!  End of program.");
                    System.exit ( 0 );
                }
            x = num;
            while (!exitPrompt.equalsIgnoreCase("end"))
            {
                System.out.println("Please enter another number: ");
                if (sc.hasNextInt())
                {
                    num=sc.nextInt();
                }else{
                    if sc.hasNext()
                    {
                        
                    }
                    System.out.println("Not a valid integer!  End of program.");
                    System.exit ( 0 );
                }
                    if (num>x)
                    {
                        x=num;
                    }
            }
           System.out.print("Your largest number was: " + x );
           System.exit ( 0 );
     }
}