Program to do some sort of number entry validation

Assignment Help JAVA Programming
Reference no: EM131565910

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<tailgate)
System.out.println("No problem!");
else if(stoppingDistance==tailgate)!
System.out.println("Minor wreck!");
else if (stoppingDistance>tailgate)
System.out.println("Major wreck!");
}}

Reference no: EM131565910

Questions Cloud

Examine the food labels for three food items : Outline how the 5/20 rule would be applied to at least two chronic diseases. For the diseases mentioned which nutrients should be reduced or increased?
Explain why titanium is a good choice of material for golf : Explain why titanium is a good choice of material for golf clubs. When not in use, discuss at least one precaution to observe when storing clubs?
Calculate the dollar cost of goods available for sale : REI carries the "Desert Rat' hiking boot whose sales are directed at Sonoran desert areas such as Arizona. Compute gross profit for each of the costing methods
What can america learn from japan : The Japanese experience demonstrates the importance of cultural issues, such as caring and sharing, that profoundly influence health outcomes.
Program to do some sort of number entry validation : The program to do some sort of number entry validation - here is what I have so far - help would be appreciated
What types of things would you want to assess : Discussion: Advanced Ergonomics- What types of things would you want to assess in terms of tools, equipment, and the general working space?
Identify an epidemiologic association of interest : Identify an epidemiologic association of interest (e.g., smoking and lung cancer, obesity and heart disease, hormonal therapy and breast cancer).
Explain how specific tutorials that you have used : For example, you could identify and explain how specific tutorials that you have used have helped improve your ability to conduct research.
Effects of water pollution on plant diversity : What effects did each of the contaminants have on the water in the experiment? Use Table 1 for reference.

Reviews

Write a Review

JAVA Programming Questions & Answers

  Calculate the cross product of two numeric vectors function

Create a function that calculate the cross product of two numeric vectors Function Name: calcCrossProduct

  Prepare a program to implement array

Write a method, insertAt, that takes four parameters: an array of integers; the length of the array; an integer, say insertItem; and an interger, say, index.

  Write an application that reads determines the surface area

Write a program that uses the top five countries' National Wealth to calculate the average of those five countries.

  Create a calculator function

This is the code for my trip planner,you need to figure out how to create a calculator function to enable users to calculate their own costs if they choose

  Write a program to create a file named "numbers.dat".

Write a program to create a file named "numbers.dat". Then create an algorithm that adds all even numbered integers from 1 to 100, separated by a comma.

  Write a java class

Write a Java class called PQueue that extends the provided abstract QueueADT class.

  Program that allows users to enter a dollar amount

Write a program that allows users to enter a dollar amount for their bank account balance at the beginning of the month. Then ask the user to enter a dollar amount for any number of checks written in a month, up to 50.

  Simple single-server queue has one line of waiting

simple single-server queue has one line of waiting customers and one server who wait on customers. suppose that

  Develop a logical database design

Develop a logical database design (relational schema) for the conceptual data model shown at the end of this document. All relations in your logical database design should be normalized to the third Normal form (3NF).

  Write a friend function that can examine the elements

Write a friend function that can examine the elements directly, or pop the stacks and save the popped elements so that the stacks can be restored.

  Your project as a programming consultant is to create a

your project as a programming consultant is to create a program that develops an amortization schedule.nbsp your

  Ticketmaster

TICKETMASTER - this class will have: a service charge = $8.00 per ticket, tax = .085 current amount of all tickets sold. Its responsibilities are printing a list of events for sale, looking up an event for a customer, and selling a ticket to the e..

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd