Java assignment
The program to do some sort of number entry validation. For example if someone enters letters I would like the program to print "invalid character entered, please just enter a number" here is what I have so far. any help would be appreciated .
import java.util.Scanner;
public class Progject{
public static void main(String[]args)
{
double speed;
double tailgate;
double stoppingDistance;
Scanner input=new Scanner(System.in);
System.out.print("Enter your speed (in mph): ");
speed=input.nextDouble();
System.out.print("Enter your tailgate distance (in feet): ");
tailgate=input.nextDouble();
stoppingDistance = speed * (2.25 + speed / 21);
if (stoppingDistance System.out.println("No problem!");
else if(stoppingDistance==tailgate)!
System.out.println("Minor wreck!");
else if (stoppingDistance>tailgate)
System.out.println("Major wreck!");
}}